Skip to content

Commit 9e317e9

Browse files
authored
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
1 parent 6ff5261 commit 9e317e9

22 files changed

+1539
-1281
lines changed

.deepsource.toml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
version: 2
22
updates:
33
- package-ecosystem: github-actions
4-
directory: "/"
4+
directory: /
55
schedule:
66
interval: monthly
7-
time: "00:00"
8-
timezone: America/Los_Angeles
9-
open-pull-requests-limit: 99
107
assignees:
118
- klane
129
labels:
1310
- dependencies
1411
- actions
12+
1513
- package-ecosystem: pip
16-
directory: "/"
14+
directory: /
1715
schedule:
1816
interval: monthly
19-
time: "00:00"
20-
timezone: America/Los_Angeles
21-
open-pull-requests-limit: 99
2217
assignees:
2318
- klane
2419
labels:

.github/workflows/quality.yml

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Quality
22

33
on:
44
push:
5-
branches: [master]
5+
branches:
6+
- main
67
pull_request:
7-
# The branches below must be a subset of the branches above
8-
branches: [master]
8+
# every Sunday at midnight
99
schedule:
1010
- cron: '0 0 * * 0'
1111

@@ -16,68 +16,20 @@ jobs:
1616

1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020

2121
- name: Initialize CodeQL
22-
uses: github/codeql-action/init@v1
22+
uses: github/codeql-action/init@v3
2323
with:
2424
languages: python
25-
# If you wish to specify custom queries, you can do so here or in a config file.
26-
# By default, queries listed here will override any specified in a config file.
27-
# Prefix the list here with "+" to use these queries and those in the config file.
28-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
2925

3026
- name: Perform CodeQL analysis
31-
uses: github/codeql-action/analyze@v1
32-
33-
linting:
34-
name: Linting
35-
runs-on: ubuntu-latest
36-
37-
steps:
38-
- name: Checkout
39-
uses: actions/checkout@v2.3.3
40-
41-
- name: Set up Python
42-
uses: actions/setup-python@v2.2.2
43-
44-
- name: Hash Python version
45-
id: hash
46-
run: echo ::set-output name=hash::$(python --version | sha256sum | cut -d' ' -f1)
47-
48-
- name: Restore cache
49-
uses: actions/cache@v2.1.6
50-
with:
51-
path: ~/.cache/pre-commit
52-
key: pre-commit|${{ steps.hash.outputs.hash }}|${{ hashFiles('.pre-commit-config.yaml') }}
53-
54-
- name: Run pre-commit
55-
uses: pre-commit/action@v2.0.3
56-
57-
safety:
58-
name: Safety
59-
runs-on: ubuntu-latest
60-
61-
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v2.3.3
64-
65-
- name: Set up Python
66-
uses: actions/setup-python@v2.2.2
67-
68-
- name: Install Poetry
69-
uses: Gr1N/setup-poetry@v7
70-
71-
- name: Install Safety
72-
run: pip install safety
73-
74-
- name: Check dependencies
75-
run: poetry export --dev --format requirements.txt | safety check --stdin --ignore=39462
27+
uses: github/codeql-action/analyze@v3
7628

7729
slack:
7830
name: Slack
7931
runs-on: ubuntu-latest
80-
needs: [analyze, linting, safety]
32+
needs: analyze
8133

8234
steps:
8335
- name: Send Slack message

.github/workflows/release.yml

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,107 @@ name: Release
33
on:
44
push:
55
tags:
6-
- v*
6+
- v*.*.*
7+
workflow_dispatch:
78

89
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Install poetry
19+
run: pipx install poetry
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install dependencies and build project
27+
run: |
28+
poetry install --without docs,test
29+
poetry build
30+
31+
- name: Upload build artifacts
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: poetry-build
35+
path: dist/
36+
937
github:
1038
name: GitHub
1139
runs-on: ubuntu-latest
40+
needs: build
1241

1342
steps:
1443
- name: Checkout
15-
uses: actions/checkout@v2.3.3
44+
uses: actions/checkout@v4
1645

17-
- name: Get tag
18-
id: tag
46+
- name: Download build artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: poetry-build
50+
path: dist
51+
52+
- name: Get changes
53+
if: github.event_name == 'push'
1954
run: |
20-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/v}
55+
tag=${GITHUB_REF#refs/tags/v}
56+
pattern="0,/$tag/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q"
57+
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md
58+
cat RELEASE.md
2159
2260
- name: Get changes
23-
id: changelog
61+
if: github.event_name == 'workflow_dispatch'
2462
run: |
25-
pattern='0,/${{ steps.tag.outputs.tag }}/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q'
63+
pattern='0,/[0-9]\+\.[0-9]\+\.[0-9]\+/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q'
2664
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md
65+
cat RELEASE.md
2766
2867
- name: Create release
29-
uses: softprops/action-gh-release@v1
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
uses: softprops/action-gh-release@v2
69+
if: success() && github.event_name == 'push'
3270
with:
3371
body_path: RELEASE.md
3472
prerelease: ${{ contains(github.ref, '-') }}
73+
files: dist/*
3574

3675
pypi:
3776
name: PyPI
3877
runs-on: ubuntu-latest
78+
needs: build
3979

4080
steps:
4181
- name: Checkout
42-
uses: actions/checkout@v2.3.3
82+
uses: actions/checkout@v4
4383

44-
- name: Set up Python
45-
uses: actions/setup-python@v2.2.2
46-
47-
- name: Install Poetry
48-
uses: Gr1N/setup-poetry@v7
84+
- name: Download build artifacts
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: poetry-build
88+
path: dist
4989

50-
- name: Install dependencies
51-
run: poetry install --no-dev
90+
- name: Install poetry
91+
run: pipx install poetry
5292

53-
- name: Build project
54-
run: poetry build
93+
- name: Set up Python
94+
uses: actions/setup-python@v5
95+
with:
96+
python-version: "3.12"
5597

5698
- name: Publish to PyPI
99+
if: success() && github.event_name == 'push'
100+
run: poetry publish
57101
env:
58102
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
59-
run: poetry publish
103+
104+
- name: Publish to TestPyPI
105+
if: success() && github.event_name == 'workflow_dispatch'
106+
run: poetry publish -r test-pypi
107+
env:
108+
POETRY_REPOSITORIES_TEST_PYPI_URL: https://test.pypi.org/legacy/
109+
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ secrets.TEST_PYPI_TOKEN }}

.github/workflows/test.yml

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,84 +3,70 @@ name: Tests
33
on:
44
push:
55
branches:
6-
- '*'
7-
paths-ignore:
8-
- 'docs/**'
9-
- '**.md'
6+
- main
107
pull_request:
11-
paths-ignore:
12-
- 'docs/**'
13-
- '**.md'
148

159
jobs:
1610
test:
17-
name: '${{ matrix.os_name }}: Python ${{ matrix.python }}'
18-
runs-on: ${{ matrix.os }}
11+
name: ${{ matrix.os.name }} / ${{ matrix.python-version }}
12+
runs-on: ${{ matrix.os.image }}
13+
defaults:
14+
run:
15+
shell: bash
1916

2017
strategy:
21-
fail-fast: false
2218
matrix:
23-
os: [ubuntu-latest, macos-latest, windows-latest]
24-
python: [3.6, 3.7, 3.8, 3.9]
25-
include:
26-
- os: ubuntu-latest
27-
os_name: Linux
28-
poetry_cache: ~/.cache/pypoetry
29-
30-
- os: macos-latest
31-
os_name: macOS
32-
poetry_cache: ~/Library/Caches/pypoetry
33-
34-
- os: windows-latest
35-
os_name: Windows
36-
poetry_cache: ~\AppData\Local\pypoetry\Cache
19+
os:
20+
- name: Ubuntu
21+
image: ubuntu-latest
22+
- name: macOS aarch64
23+
image: macos-latest
24+
- name: macOS x86_64
25+
image: macos-13
26+
- name: Windows
27+
image: windows-latest
28+
python-version:
29+
- "3.9"
30+
- "3.10"
31+
- "3.11"
32+
- "3.12"
33+
fail-fast: false
3734

3835
steps:
3936
- name: Checkout
40-
uses: actions/checkout@v2.3.3
41-
42-
- name: Set up Python
43-
uses: actions/setup-python@v2.2.2
44-
with:
45-
python-version: ${{ matrix.python }}
46-
47-
- name: Install Poetry
48-
uses: Gr1N/setup-poetry@v7
37+
uses: actions/checkout@v4
4938

50-
- name: Write environment information to a file
51-
run: |
52-
pwd > environment
53-
python --version >> environment
39+
- name: Install poetry
40+
run: pipx install poetry
5441

55-
- name: Restore cache
56-
uses: actions/cache@v2.1.6
57-
if: runner.os != 'Windows'
42+
- name: Set up Python ${{ matrix.python-version }}
43+
uses: actions/setup-python@v5
5844
with:
59-
path: ${{ matrix.poetry_cache }}
60-
key: poetry|${{ hashFiles('environment') }}|${{ hashFiles('poetry.lock') }}
45+
python-version: ${{ matrix.python-version }}
46+
cache: poetry
6147

6248
- name: Install dependencies
63-
run: poetry install
49+
run: |
50+
poetry install
51+
pip install pytest-github-actions-annotate-failures
6452
6553
- name: Run tests
66-
run: poetry run pytest tests/ --cov=jekyllnb
67-
68-
- name: Generate coverage report
69-
run: poetry run coverage xml
54+
run: poetry run pytest --cov-report xml:coverage.xml
7055

7156
- name: Upload coverage report
72-
uses: codecov/codecov-action@v2.1.0
57+
uses: codecov/codecov-action@v4
7358
if: success()
7459
with:
60+
file: coverage.xml
61+
fail_ci_if_error: true
7562
token: ${{ secrets.CODECOV_TOKEN }}
76-
file: ./coverage.xml
7763

7864
- name: Send Slack message on failure
7965
uses: lazy-actions/slatify@v3.0.0
8066
if: failure()
8167
with:
8268
type: ${{ job.status }}
83-
job_name: '${{ runner.os }} :snake: ${{ matrix.python }} Tests'
69+
job_name: '${{ runner.os }} :snake: ${{ matrix.python-version }} Tests'
8470
url: ${{ secrets.SLACK_WEBHOOK }}
8571
commit: true
8672
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ dist/
2020

2121
# pyenv version file
2222
.python-version
23+
24+
# docs site
25+
site/

0 commit comments

Comments
 (0)