Skip to content

Commit 9684de4

Browse files
authored
Refactor GHA pipelines (#10)
1 parent 9ac9f07 commit 9684de4

File tree

2 files changed

+30
-43
lines changed

2 files changed

+30
-43
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,18 @@
33
# https://github.com/dependabot/dependabot-core/issues/369
44
version: 2
55
updates:
6-
- package-ecosystem: pip
7-
directory: /docs
8-
schedule:
9-
day: sunday
10-
interval: weekly
11-
labels:
12-
- dependabot-deps-updates
13-
- skip-changelog
14-
versioning-strategy: lockfile-only
15-
open-pull-requests-limit: 0 # neutered
166
- package-ecosystem: pip
177
directory: /
188
schedule:
19-
day: sunday
20-
interval: weekly
9+
interval: daily
2110
labels:
2211
- dependabot-deps-updates
2312
- skip-changelog
2413
versioning-strategy: lockfile-only
25-
open-pull-requests-limit: 0 # neutered
2614
- package-ecosystem: "github-actions"
2715
directory: "/"
2816
schedule:
29-
interval: weekly
30-
open-pull-requests-limit: 3
17+
interval: daily
3118
labels:
3219
- "dependencies"
3320
- "skip-changelog"

.github/workflows/tox.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ env:
2020
PY_COLORS: 1
2121

2222
jobs:
23+
pre:
24+
name: pre
25+
runs-on: ubuntu-22.04
26+
outputs:
27+
matrix: ${{ steps.generate_matrix.outputs.matrix }}
28+
steps:
29+
- name: Determine matrix
30+
id: generate_matrix
31+
uses: coactions/matrix@main
32+
with:
33+
other_names: |
34+
lint
35+
pkg
36+
devel
2337
build:
24-
name: ${{ matrix.name || matrix.tox_env }}
38+
name: ${{ matrix.name || matrix.passed_name || '?' }}
39+
needs: pre
2540
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
2641
defaults:
2742
run:
2843
shell: ${{ matrix.shell || 'bash'}}
2944
strategy:
3045
fail-fast: false
31-
matrix:
32-
include:
33-
- tox_env: lint
34-
- name: pkg
35-
tox_env: pkg
36-
- name: py38
37-
tox_env: py38,py38-devel
38-
python-version: 3.8
39-
- name: py39
40-
tox_env: py39,py39-devel
41-
python-version: 3.9
42-
- tox_env: py310
43-
python-version: "3.10"
44-
- name: py311
45-
tox_env: py311,py311-devel
46-
python-version: "3.11"
46+
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
4747
env:
4848
PYTEST_REQPASS: 1
4949

@@ -53,17 +53,17 @@ jobs:
5353
fetch-depth: 0 # needed by setuptools-scm
5454

5555
- name: Set caches
56-
if: "${{ contains(matrix.tox_env, 'lint') }}"
56+
if: "${{ contains(matrix.passed_name, 'lint') }}"
5757
uses: actions/cache@v3
5858
with:
5959
path: ~/.cache/pre-commit
60-
key: ${{ matrix.name || matrix.tox_env }}-${{ hashFiles('.pre-commit-config.yaml') }}
60+
key: ${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }}
6161

62-
- name: Set up Python ${{ matrix.python-version || '3.9' }}
62+
- name: Set up Python ${{ matrix.python_version || '3.9' }}
6363
uses: actions/setup-python@v4
6464
with:
6565
cache: pip
66-
python-version: ${{ matrix.python-version || '3.9' }}
66+
python-version: ${{ matrix.python_version || '3.9' }}
6767

6868
- name: Install tox
6969
run: |
@@ -73,24 +73,24 @@ jobs:
7373
- name: Log installed dists
7474
run: python3 -m pip freeze --all
7575

76-
- name: Initialize tox envs ${{ matrix.tox_env }}
77-
run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.tox_env }}
76+
- name: Initialize tox envs ${{ matrix.passed_env }}
77+
run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }}
7878
timeout-minutes: 5 # average is under 1, but macos can be over 3
7979

8080
# sequential run improves browsing experience (almost no speed impact)
81-
- name: tox -e ${{ matrix.tox_env }}
82-
run: python3 -m tox -e ${{ matrix.tox_env }}
81+
- name: tox -e ${{ matrix.passed_name }}
82+
run: python3 -m tox -e ${{ matrix.passed_name }}
8383

8484
- name: Combine coverage data
85-
if: ${{ startsWith(matrix.tox_env, 'py') }}
85+
if: ${{ startsWith(matrix.passed_name, 'py') }}
8686
# produce a single .coverage file at repo root
8787
run: tox -e coverage
8888

8989
- name: Upload coverage data
90-
if: ${{ startsWith(matrix.tox_env, 'py') }}
90+
if: ${{ startsWith(matrix.passed_name, 'py') }}
9191
uses: codecov/codecov-action@v3
9292
with:
93-
name: ${{ matrix.tox_env }}
93+
name: ${{ matrix.passed_name }}
9494
fail_ci_if_error: false # see https://github.com/codecov/codecov-action/issues/598
9595
token: ${{ secrets.CODECOV_TOKEN }}
9696
verbose: true # optional (default = false)

0 commit comments

Comments
 (0)