Debian Codegraph @

.github/workflows/test.yml

raw
1 name: test
2
3 on:
4 push:
5 paths:
6 - .github/workflows/test.yml
7 - src/**
8 - tests/**
9 - tox.ini
10 - pyproject.toml
11
12 pull_request:
13 paths:
14 - .github/workflows/test.yml
15 - src/**
16 - tests/**
17 - tox.ini
18 - pyproject.toml
19
20 permissions:
21 contents: read
22
23 concurrency:
24 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
25 cancel-in-progress: true
26
27 jobs:
28 test:
29 # We want to run on external PRs, but not on our own internal PRs as they'll be run
30 # by the push to the branch. Without this if check, checks are duplicated since
31 # internal PRs match both the push and pull_request events.
32 if:
33 github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
34 github.repository
35
36 runs-on: ${{ matrix.os }}
37 strategy:
38 fail-fast: false
39 matrix:
40 python-version: ["3.10", "3.11", "3.12.10", "3.13", "3.14", "3.15", "pypy-3.11"]
41 os: [ubuntu-latest, macOS-latest, windows-latest, windows-11-arm]
42 exclude:
43 # setup-python only supports CPython 3.11+ on arm64 windows
44 - os: windows-11-arm
45 python-version: "3.10"
46 - os: windows-11-arm
47 python-version: "pypy-3.11"
48
49 steps:
50 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
51 with:
52 persist-credentials: false
53
54 - name: Set up Python ${{ matrix.python-version }}
55 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
56 with:
57 python-version: ${{ matrix.python-version }}
58 allow-prereleases: true
59 pip-version: "25.3"
60 pip-install: --group tox
61
62 - name: Unit tests
63 if: "!startsWith(matrix.python-version, 'pypy')"
64 run:
65 tox -e ci-py$(echo ${{ matrix.python-version }} | tr -d '.') -- -v --color=yes
66
67 - name: Unit tests (pypy)
68 if: "startsWith(matrix.python-version, 'pypy')"
69 run: tox -e ci-pypy3 -- -v --color=yes
70
71 - name: Upload coverage to Coveralls
72 # Upload coverage if we are on the main repository and
73 # we're running on Linux (this action only supports Linux)
74 if:
75 github.repository == 'psf/black' && matrix.os == 'ubuntu-latest' &&
76 !startsWith(matrix.python-version, 'pypy')
77 uses: AndreMiras/coveralls-python-action@ac868b9540fad490f7ca82b8ca00480fd751ed19
78 with:
79 github-token: ${{ secrets.GITHUB_TOKEN }}
80 parallel: true
81 flag-name: py${{ matrix.python-version }}-${{ matrix.os }}
82 debug: true
83
84 coveralls-finish:
85 needs: test
86 if: github.repository == 'psf/black'
87
88 runs-on: ubuntu-latest
89 steps:
90 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
91 with:
92 persist-credentials: false
93
94 - name: Send finished signal to Coveralls
95 uses: AndreMiras/coveralls-python-action@ac868b9540fad490f7ca82b8ca00480fd751ed19
96 with:
97 parallel-finished: true
98 debug: true
99
100 uvloop:
101 if:
102 github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
103 github.repository
104 runs-on: ${{ matrix.os }}
105 strategy:
106 fail-fast: false
107 matrix:
108 os: [ubuntu-latest, macOS-latest, windows-latest, windows-11-arm]
109
110 steps:
111 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112 with:
113 persist-credentials: false
114
115 - name: Set up latest Python
116 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
117 with:
118 python-version: "3.13"
119 pip-version: "25.3"
120 pip-install: -e .[uvloop]
121
122 - name: Format ourselves
123 run: python -m black --check .