Skip to content

Commit 144e217

Browse files
committed
ci: run Nox sessions in GitHub Actions
1 parent 23e9a5e commit 144e217

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/workflows/package-ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Package CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
sessions:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
build-sessions: ${{ steps.matrix.outputs.build-sessions }}
16+
lint-sessions: ${{ steps.matrix.outputs.lint-sessions }}
17+
test-sessions: ${{ steps.matrix.outputs.test-sessions }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: wntrblm/nox@main
21+
- id: matrix
22+
run: |
23+
for session in build lint test; do
24+
echo "${session}-sessions=$(nox -t $session -l --json | jq -c '[.[].session]')" >> $GITHUB_OUTPUT
25+
done
26+
build:
27+
name: ${{ matrix.session }}
28+
needs:
29+
- sessions
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
session: ${{ fromJson(needs.sessions.outputs.build-sessions) }}
34+
fail-fast: false
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: wntrblm/nox@main
38+
- run: nox -s "${{ matrix.session }}"
39+
lint:
40+
name: ${{ matrix.session }}
41+
needs:
42+
- sessions
43+
- build
44+
runs-on: ubuntu-latest
45+
strategy:
46+
matrix:
47+
session: ${{ fromJson(needs.sessions.outputs.lint-sessions) }}
48+
fail-fast: false
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: wntrblm/nox@main
52+
- run: nox -s "${{ matrix.session }}"
53+
test:
54+
name: ${{ matrix.session }}
55+
needs:
56+
- sessions
57+
- build
58+
runs-on: ubuntu-latest
59+
strategy:
60+
matrix:
61+
session: ${{ fromJson(needs.sessions.outputs.test-sessions) }}
62+
fail-fast: false
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: wntrblm/nox@main
66+
- run: nox -s "${{ matrix.session }}"

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# django-management-commands
22

33
[![Pre-commit.ci](https://results.pre-commit.ci/badge/github/paduszyk/django-management-commands/main.svg)][pre-commit.ci]
4+
[![CI](https://img.shields.io/github/actions/workflow/status/paduszyk/django-management-commands/package-ci.yml?logo=github&label=CI)][ci]
45

56
[![Nox](https://img.shields.io/badge/%f0%9f%a6%8a-Nox-d85e00)][nox]
67
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)][ruff]
@@ -12,6 +13,7 @@
1213

1314
Released under the [MIT license][license].
1415

16+
[ci]: https://github.com/paduszyk/django-management-commands/actions/workflows/package-ci.yml
1517
[conventional-commits]: https://www.conventionalcommits.org/
1618
[license]: https://github.com/paduszyk/django-management-commands/blob/main/LICENSE
1719
[mypy]: https://mypy.readthedocs.io

0 commit comments

Comments
 (0)