-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and tooling (#251)
- Fixes CI pipelines that were broken due to the [deprecated `set-output` command](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) - Drops support for Python 3.6-3.8 - Updates dependencies, pre-commit hooks and GitHub Actions - Adds `mkdocs` as a dev dependency to build documentation locally - Adds `pytest-xdist` as a dev dependency to run tests in parallel - Removes `pytest-lazy-fixture` as a dev dependency since it [does not support `pytest` 8](TvoroG/pytest-lazy-fixture#65) - Removes `tox` as a dev dependency - Migrates code formatting and linting to ruff
- Loading branch information
Showing
22 changed files
with
1,539 additions
and
1,281 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ name: Quality | |
|
||
on: | ||
push: | ||
branches: [master] | ||
branches: | ||
- main | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [master] | ||
# every Sunday at midnight | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
|
@@ -16,68 +16,20 @@ jobs: | |
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: python | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
- name: Perform CodeQL analysis | ||
uses: github/codeql-action/analyze@v1 | ||
|
||
linting: | ||
name: Linting | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
|
||
- name: Hash Python version | ||
id: hash | ||
run: echo ::set-output name=hash::$(python --version | sha256sum | cut -d' ' -f1) | ||
|
||
- name: Restore cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ steps.hash.outputs.hash }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
|
||
safety: | ||
name: Safety | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
|
||
- name: Install Poetry | ||
uses: Gr1N/setup-poetry@v7 | ||
|
||
- name: Install Safety | ||
run: pip install safety | ||
|
||
- name: Check dependencies | ||
run: poetry export --dev --format requirements.txt | safety check --stdin --ignore=39462 | ||
uses: github/codeql-action/analyze@v3 | ||
|
||
slack: | ||
name: Slack | ||
runs-on: ubuntu-latest | ||
needs: [analyze, linting, safety] | ||
needs: analyze | ||
|
||
steps: | ||
- name: Send Slack message | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,57 +3,107 @@ name: Release | |
on: | ||
push: | ||
tags: | ||
- v* | ||
- v*.*.* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies and build project | ||
run: | | ||
poetry install --without docs,test | ||
poetry build | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: poetry-build | ||
path: dist/ | ||
|
||
github: | ||
name: GitHub | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get tag | ||
id: tag | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: poetry-build | ||
path: dist | ||
|
||
- name: Get changes | ||
if: github.event_name == 'push' | ||
run: | | ||
echo ::set-output name=tag::${GITHUB_REF#refs/tags/v} | ||
tag=${GITHUB_REF#refs/tags/v} | ||
pattern="0,/$tag/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q" | ||
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md | ||
cat RELEASE.md | ||
- name: Get changes | ||
id: changelog | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
pattern='0,/${{ steps.tag.outputs.tag }}/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q' | ||
pattern='0,/[0-9]\+\.[0-9]\+\.[0-9]\+/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q' | ||
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md | ||
cat RELEASE.md | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: softprops/action-gh-release@v2 | ||
if: success() && github.event_name == 'push' | ||
with: | ||
body_path: RELEASE.md | ||
prerelease: ${{ contains(github.ref, '-') }} | ||
files: dist/* | ||
|
||
pypi: | ||
name: PyPI | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
|
||
- name: Install Poetry | ||
uses: Gr1N/setup-poetry@v7 | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: poetry-build | ||
path: dist | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-dev | ||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Build project | ||
run: poetry build | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Publish to PyPI | ||
if: success() && github.event_name == 'push' | ||
run: poetry publish | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish | ||
|
||
- name: Publish to TestPyPI | ||
if: success() && github.event_name == 'workflow_dispatch' | ||
run: poetry publish -r test-pypi | ||
env: | ||
POETRY_REPOSITORIES_TEST_PYPI_URL: https://test.pypi.org/legacy/ | ||
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ secrets.TEST_PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,84 +3,70 @@ name: Tests | |
on: | ||
push: | ||
branches: | ||
- '*' | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**.md' | ||
- main | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**.md' | ||
|
||
jobs: | ||
test: | ||
name: '${{ matrix.os_name }}: Python ${{ matrix.python }}' | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os.name }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os.image }} | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python: [3.6, 3.7, 3.8, 3.9] | ||
include: | ||
- os: ubuntu-latest | ||
os_name: Linux | ||
poetry_cache: ~/.cache/pypoetry | ||
|
||
- os: macos-latest | ||
os_name: macOS | ||
poetry_cache: ~/Library/Caches/pypoetry | ||
|
||
- os: windows-latest | ||
os_name: Windows | ||
poetry_cache: ~\AppData\Local\pypoetry\Cache | ||
os: | ||
- name: Ubuntu | ||
image: ubuntu-latest | ||
- name: macOS aarch64 | ||
image: macos-latest | ||
- name: macOS x86_64 | ||
image: macos-13 | ||
- name: Windows | ||
image: windows-latest | ||
python-version: | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
- "3.12" | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install Poetry | ||
uses: Gr1N/setup-poetry@v7 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Write environment information to a file | ||
run: | | ||
pwd > environment | ||
python --version >> environment | ||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Restore cache | ||
uses: actions/[email protected] | ||
if: runner.os != 'Windows' | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
path: ${{ matrix.poetry_cache }} | ||
key: poetry|${{ hashFiles('environment') }}|${{ hashFiles('poetry.lock') }} | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
run: | | ||
poetry install | ||
pip install pytest-github-actions-annotate-failures | ||
- name: Run tests | ||
run: poetry run pytest tests/ --cov=jekyllnb | ||
|
||
- name: Generate coverage report | ||
run: poetry run coverage xml | ||
run: poetry run pytest --cov-report xml:coverage.xml | ||
|
||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v2.1.0 | ||
uses: codecov/codecov-action@v4 | ||
if: success() | ||
with: | ||
file: coverage.xml | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
|
||
- name: Send Slack message on failure | ||
uses: lazy-actions/[email protected] | ||
if: failure() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: '${{ runner.os }} :snake: ${{ matrix.python }} Tests' | ||
job_name: '${{ runner.os }} :snake: ${{ matrix.python-version }} Tests' | ||
url: ${{ secrets.SLACK_WEBHOOK }} | ||
commit: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,6 @@ dist/ | |
|
||
# pyenv version file | ||
.python-version | ||
|
||
# docs site | ||
site/ |
Oops, something went wrong.