Skip to content

Commit c8584e7

Browse files
committed
tox -> nox
1 parent b0604fb commit c8584e7

File tree

4 files changed

+250
-259
lines changed

4 files changed

+250
-259
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -9,169 +9,86 @@ on:
99
# Daily at 3:21
1010
- cron: "21 3 * * *"
1111

12+
env:
13+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
14+
PIP_NO_PYTHON_VERSION_WARNING: "1"
15+
1216
jobs:
1317
pre-commit:
1418
runs-on: ubuntu-latest
1519
steps:
1620
- uses: actions/checkout@v3
1721
- uses: actions/setup-python@v4
1822
with:
19-
python-version: "3.11"
23+
python-version: "3.x"
2024
- uses: pre-commit/[email protected]
2125

26+
list:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up nox
33+
uses: wntrblm/[email protected]
34+
- id: noxenvs-matrix
35+
run: |
36+
echo >>$GITHUB_OUTPUT noxenvs=$(
37+
nox --list-sessions |
38+
grep '^* ' |
39+
cut -d ' ' -f 2- |
40+
jq --raw-input --slurp 'split("\n") | map(select(. != ""))'
41+
)
42+
2243
ci:
44+
needs: list
2345
runs-on: ${{ matrix.os }}
2446
strategy:
2547
fail-fast: false
2648
matrix:
2749
os: [macos-latest, ubuntu-latest, windows-latest]
28-
python-version:
29-
- name: pypy-3.9
30-
toxenv: pypy3-noextra-build
31-
- name: pypy-3.9
32-
toxenv: pypy3-noextra-tests
33-
- name: pypy-3.9
34-
toxenv: pypy3-format-build
35-
- name: pypy-3.9
36-
toxenv: pypy3-format-tests
37-
- name: pypy-3.9
38-
toxenv: pypy3-formatnongpl-build
39-
- name: pypy-3.9
40-
toxenv: pypy3-formatnongpl-tests
41-
- name: 3.8
42-
toxenv: py38-noextra-build
43-
- name: 3.8
44-
toxenv: py38-noextra-tests
45-
- name: 3.8
46-
toxenv: py38-format-build
47-
- name: 3.8
48-
toxenv: py38-format-tests
49-
- name: 3.8
50-
toxenv: py38-formatnongpl-build
51-
- name: 3.8
52-
toxenv: py38-formatnongpl-tests
53-
- name: 3.9
54-
toxenv: py39-noextra-build
55-
- name: 3.9
56-
toxenv: py39-noextra-tests
57-
- name: 3.9
58-
toxenv: py39-format-build
59-
- name: 3.9
60-
toxenv: py39-format-tests
61-
- name: 3.9
62-
toxenv: py39-formatnongpl-build
63-
- name: 3.9
64-
toxenv: py39-formatnongpl-tests
65-
- name: "3.10"
66-
toxenv: py310-noextra-build
67-
- name: "3.10"
68-
toxenv: py310-noextra-tests
69-
- name: "3.10"
70-
toxenv: py310-format-build
71-
- name: "3.10"
72-
toxenv: py310-format-tests
73-
- name: "3.10"
74-
toxenv: py310-formatnongpl-build
75-
- name: "3.10"
76-
toxenv: py310-formatnongpl-tests
77-
- name: "3.11"
78-
toxenv: py311-noextra-build
79-
- name: "3.11"
80-
toxenv: py311-noextra-tests
81-
- name: "3.11"
82-
toxenv: py311-format-build
83-
- name: "3.11"
84-
toxenv: py311-format-tests
85-
- name: "3.11"
86-
toxenv: py311-formatnongpl-build
87-
- name: "3.11"
88-
toxenv: py311-formatnongpl-tests
89-
- name: "3.11"
90-
toxenv: docs-dirhtml
91-
- name: "3.11"
92-
toxenv: docs-doctest
93-
- name: "3.11"
94-
toxenv: docs-linkcheck
95-
- name: "3.11"
96-
toxenv: docs-spelling
97-
- name: "3.11"
98-
toxenv: docs-style
99-
- name: "3.11"
100-
toxenv: readme
101-
- name: "3.11"
102-
toxenv: secrets
103-
- name: "3.11"
104-
toxenv: style
105-
- name: "3.11"
106-
toxenv: typing
50+
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }}
51+
posargs: [""]
10752
include:
10853
- os: ubuntu-latest
109-
python-version:
110-
name: "3.11"
111-
toxenv: py311-format-ghcoverage
112-
- os: ubuntu-latest
113-
python-version:
114-
name: "3.11"
115-
toxenv: py311-noextra-ghcoverage
116-
- os: ubuntu-latest
117-
python-version:
118-
name: "3.11"
119-
toxenv: format-audit
120-
- os: ubuntu-latest
121-
python-version:
122-
name: "3.11"
123-
toxenv: formatnongpl-audit
54+
noxenv: "tests-3.11(extras='[format]')"
55+
posargs: ghcoverage
12456
- os: ubuntu-latest
125-
python-version:
126-
name: "3.11"
127-
toxenv: noextra-audit
57+
noxenv: "tests-3.11(extras='')"
58+
posargs: ghcoverage
12859
exclude:
12960
- os: windows-latest
130-
python-version:
131-
name: "3.11"
132-
toxenv: readme
61+
noxenv: readme
13362
- os: windows-latest
134-
python-version:
135-
name: "3.11"
136-
toxenv: docs-dirhtml
63+
noxenv: "docs(dirhtml)"
13764
- os: windows-latest
138-
python-version:
139-
name: "3.11"
140-
toxenv: docs-doctest
65+
noxenv: "docs(doctest)"
14166
- os: windows-latest
142-
python-version:
143-
name: "3.11"
144-
toxenv: docs-linkcheck
67+
noxenv: "docs(linkcheck)"
14568
- os: windows-latest
146-
python-version:
147-
name: "3.11"
148-
toxenv: docs-spelling
69+
noxenv: "docs(spelling)"
14970
- os: windows-latest
150-
python-version:
151-
name: "3.11"
152-
toxenv: docs-style
71+
noxenv: "docs(style)"
15372

15473
steps:
15574
- uses: actions/checkout@v3
156-
- name: Set up Python ${{ matrix.python-version.name }}
157-
uses: actions/setup-python@v4
158-
with:
159-
python-version: ${{ matrix.python-version.name }}
16075
- name: Install dependencies
161-
run: >
162-
sudo apt-get update &&
163-
sudo apt-get install -y libenchant-2-dev libxml2-dev libxslt-dev
164-
if: runner.os == 'Linux' && startsWith(matrix.python-version.toxenv, 'docs-')
76+
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev
77+
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs')
16578
- name: Install dependencies
16679
run: brew install enchant
167-
if: runner.os == 'macOS' && startsWith(matrix.python-version.toxenv, 'docs-')
168-
- name: Install tox
169-
run: python -m pip install tox
80+
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs')
81+
- name: Set up Python
82+
uses: actions/setup-python@v4
83+
with:
84+
python-version: "3.x"
85+
- name: Set up nox
86+
uses: wntrblm/[email protected]
17087
- name: Enable UTF-8 on Windows
17188
run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV
172-
if: runner.os == 'Windows' && startsWith(matrix.python-version.toxenv, 'py')
173-
- name: Run tox
174-
run: python -m tox -e "${{ matrix.python-version.toxenv }}"
89+
if: runner.os == 'Windows' && startsWith(matrix.noxenv, 'tests')
90+
- name: Run nox
91+
run: nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }}
17592

17693
packaging:
17794
needs: ci
@@ -181,30 +98,23 @@ jobs:
18198
- uses: actions/checkout@v3
18299
with:
183100
fetch-depth: 0
184-
- uses: actions/setup-python@v4
101+
- name: Set up Python
102+
uses: actions/setup-python@v4
185103
with:
186-
python-version: "3.10"
104+
python-version: "3.x"
187105
- name: Install dependencies
188106
run: python -m pip install build
189107
- name: Create packages
190108
run: python -m build .
191-
- uses: actions/upload-artifact@v3
192-
with:
193-
name: dist
194-
path: dist
195-
- name: Publish package
109+
- name: Publish to PyPI
196110
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
197111
uses: pypa/gh-action-pypi-publish@release/v1
198112
with:
199-
user: __token__
200113
password: ${{ secrets.pypi_password }}
201-
- name: Create Release Notes
114+
- name: Create a Release
202115
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
203-
uses: actions/github-script@v6
116+
uses: softprops/action-gh-release@v1
204117
with:
205-
github-token: ${{ secrets.GITHUB_TOKEN }}
206-
script: |
207-
await github.request(`POST /repos/${{ github.repository }}/releases`, {
208-
tag_name: "${{ github.ref }}",
209-
generate_release_notes: true
210-
});
118+
files: |
119+
dist/*
120+
generate_release_notes: true

0 commit comments

Comments
 (0)