Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build!: drop python3.7, remove deprecated markdown cell syntax, hide migration guide banner #119

Merged
merged 15 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/apply-pip-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Apply pip compile (generate lockfiles)

on: workflow_dispatch

jobs:
apply-pip-compile:
name: Apply pip compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
run: |
pip3 install uv
- name: Run uv pip compile and push
run: |
set +e # Do not exit shell on failure
bash scripts/compile_requirements.sh
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m "build: update requirements using uv pip compile [skip ci]"
git push
35 changes: 35 additions & 0 deletions .github/workflows/apply-styles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Apply ruff format, isort, and fixes

on:
workflow_dispatch:
inputs:
ruff_select:
description: 'ruff select'
default: I,D20,D21,UP00,UP032,UP034
ruff_ignore:
description: 'ruff ignore'
default: D212

jobs:
apply-ruff:
name: Apply ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install ruff
run: |
pip3 install -r <(grep '^ruff==' deps/x86_64-unknown-linux-gnu/requirements_dev.txt)
- name: Run ruff and push
run: |
set +e # Do not exit shell on ruff failure
ruff --select=${{ github.event.inputs.ruff_select }} --ignore=${{ github.event.inputs.ruff_ignore }} --fix --unsafe-fixes .
ruff format .
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m "style: ruff format, isort, fixes [skip ci]"
git push
45 changes: 45 additions & 0 deletions .github/workflows/check-pip-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Check pip compile sync

on: [push, pull_request]

jobs:
check-pip-compile:
name: Check pip compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
run: |
pip3 install uv
- name: Generate lockfile and print diff
run: |
set +e # Do not exit shell on failure

out=$(bash scripts/compile_requirements.sh 2> _stderr.txt)
exit_code=$?
err=$(<_stderr.txt)

if [[ -n "$out" ]]; then
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
{ echo "\`\`\`"; echo "${out}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ -n "$err" ]]; then
echo "${err}"
{ echo "\`\`\`"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi

if [[ $exit_code -eq 0 ]]; then
# When the script fails, there are changes in requirements that are not compiled yet.
# Print the suggested changes.
{ echo "\`\`\`diff"; git diff; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
exit 1
fi

# When the script fails, it means it does not have anything to compile.
exit 0
93 changes: 56 additions & 37 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,94 @@
name: Deploy
name: Deploy a new version

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
workflow_dispatch:
inputs:
version_tag:
description: 'Version tag'
required: true
default: v0.1.0
dry_run:
type: boolean
description: 'Dry run'
default: false

jobs:
deploy:
runs-on: ubuntu-latest
environment: deploy
environment: mkdocs

steps:
- name: Checkout to the branch of the tag
- uses: actions/checkout@v4
- name: Push new version tag temporarily for changelog generation
run: |
# checkout from GitHub CI without using actions/checkout
git clone https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git .
git fetch origin ${{ github.ref_name }}
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git tag -a ${{ github.event.inputs.version_tag }} -m ${{ github.event.inputs.version_tag }}
git push --tags

# check if git tag is the last commit of some branch
TAG=${{ github.ref_name }}
git branch -a --contains $TAG
BRANCH=$(git branch -a --contains $TAG | grep -v HEAD | head -n 1 | sed 's/^* //' | sed 's/^ //')
echo "branch: $BRANCH"
LAST_COMMIT=$(git rev-parse $BRANCH)
echo "last commit hash: $LAST_COMMIT"
TAG_COMMIT=$(git rev-list -n 1 $TAG)
echo "tag commit hash: $TAG_COMMIT"
- name: (dry-run) Get CHANGELOG
if: ${{ github.event.inputs.dry_run }}
id: changelog-dry-run
uses: requarks/[email protected]
with:
includeInvalidCommits: true
excludeTypes: build,docs,style,other
token: ${{ github.token }}
tag: ${{ github.event.inputs.version_tag }}

if [[ "$LAST_COMMIT" != "$TAG_COMMIT" ]]; then
echo "ERROR: Tag $TAG is NOT the last commit of branch $BRANCH. Exiting.."
exit 1
fi
- name: (dry-run) Display CHANGELOG
if: ${{ github.event.inputs.dry_run }}
run: |
echo '${{ steps.changelog-dry-run.outputs.changes }}'
echo '${{ steps.changelog-dry-run.outputs.changes }}' > "$GITHUB_STEP_SUMMARY"

git checkout "$BRANCH"
- name: (dry-run) Remove temporary version tag
if: ${{ github.event.inputs.dry_run }}
run: |
git tag -d ${{ github.event.inputs.version_tag }}
git push origin --delete ${{ github.event.inputs.version_tag }}

- name: Update CHANGELOG
if: ${{ !github.event.inputs.dry_run }}
id: changelog
uses: requarks/changelog-action@v1
uses: requarks/changelog-action@v1.10.2
with:
includeInvalidCommits: true
excludeTypes: build,docs,style
excludeTypes: build,docs,style,other
token: ${{ github.token }}
tag: ${{ github.ref_name }}
tag: ${{ github.event.inputs.version_tag }}
changelogFilePath: docs/CHANGELOG.md

- name: Commit CHANGELOG.md
- name: Commit docs/CHANGELOG.md and update tag
if: ${{ !github.event.inputs.dry_run }}
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -d ${{ github.ref_name }}
git push origin --delete ${{ github.ref_name }}
git add CHANGELOG.md
git commit -m "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
git tag -a ${{ github.ref_name }} -m ${{ github.ref_name }}
git tag -d ${{ github.event.inputs.version_tag }}
git push origin --delete ${{ github.event.inputs.version_tag }}
git add docs/CHANGELOG.md
git commit -m "docs: update docs/CHANGELOG.md for ${{ github.event.inputs.version_tag }} [skip ci]"
git tag -a ${{ github.event.inputs.version_tag }} -m ${{ github.event.inputs.version_tag }}
git push
git push --tags

- name: Create Release
uses: ncipollo/[email protected]
if: ${{ !github.event.inputs.dry_run }}
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
name: ${{ github.event.inputs.version_tag }}
tag: ${{ github.event.inputs.version_tag }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}

- name: Set up Python 3.11
if: ${{ !github.event.inputs.dry_run }}
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Build and upload to PyPI
if: ${{ !github.event.inputs.dry_run }}
run: |
python -m pip install --upgrade pip
pip3 install build twine
Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ jobs:
python-version-file: pyproject.toml
- name: Install ruff and requirements
run: |
pip3 install -r <(cat requirements_dev.txt | grep '^ruff==')
- name: Run ruff
pip3 install -r <(grep '^ruff==' deps/x86_64-unknown-linux-gnu/requirements_dev.txt)
- name: Run ruff (code annotation)
run: |
set +e # Do not exit shell on ruff failure

ruff check --output-format=github
exit 0
- name: Run ruff (summary)
run: |
set +e # Do not exit shell on ruff failure

nonzero_exit=0
files=$(find . -type f -name "*.py" | sort)
while read file; do
while read -r file; do
out=$(ruff check --force-exclude "$file" 2> ruff_stderr.txt)
exit_code=$?
err=$(<ruff_stderr.txt)
Expand All @@ -34,15 +40,11 @@ jobs:
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`python"; echo "${out}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ -n "$err" ]]; then
echo "${err}"
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`python"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi

out=$(ruff check --diff --force-exclude "$file" 2> ruff_stderr.txt)
Expand All @@ -52,15 +54,11 @@ jobs:
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`python"; echo "${out}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ -n "$err" ]]; then
echo "${err}"
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`python"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
done <<< "$files"

Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ name: Style checking
on: [push, pull_request]

jobs:
stylua:
name: StyLua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint with stylua
uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .

ruff-format:
name: ruff-format
runs-on: ubuntu-latest
Expand All @@ -26,7 +14,7 @@ jobs:
python-version-file: pyproject.toml
- name: Install ruff
run: |
pip3 install -r <(cat requirements_dev.txt | grep '^ruff==')
pip3 install -r <(grep '^ruff==' deps/x86_64-unknown-linux-gnu/requirements_dev.txt)
- name: Run ruff format
run: |
set +e # Do not exit shell on black failure
Expand All @@ -39,10 +27,7 @@ jobs:
echo "${err}"

# Display the Markdown output in the job summary
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`diff"; echo "${out}"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"

# Exit with the exit-code returned by ruff
exit ${exit_code}
Expand All @@ -58,7 +43,7 @@ jobs:
python-version-file: pyproject.toml
- name: Install ruff
run: |
pip3 install -r <(cat requirements_dev.txt | grep '^ruff==')
pip3 install -r <(grep '^ruff==' deps/x86_64-unknown-linux-gnu/requirements_dev.txt)
- name: Run ruff isort
run: |
set +e # Do not exit shell on app failure
Expand All @@ -71,10 +56,7 @@ jobs:
echo "${err}"

# Display the Markdown output in the job summary
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
{ echo "\`\`\`diff"; echo "${out}"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"

# Exit with the exit-code returned by ruff
exit ${exit_code}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
nvim-tag: [stable]

steps:
Expand All @@ -21,7 +21,7 @@ jobs:
run: |
sudo apt-get update && sudo apt-get install libfuse2
sudo add-apt-repository universe
wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim.appimage
wget https://github.com/neovim/neovim/releases/download/"${NVIM_TAG}"/nvim.appimage
chmod u+x nvim.appimage && sudo mv nvim.appimage /usr/local/bin/nvim
# mkdir -p ~/.local/share/nvim/site/pack/tests/opt
# ln -s $(pwd) ~/.local/share/nvim/site/pack/tests/opt
Expand Down
Loading
Loading