Debian Codegraph @

testing/web-platform/tests/tools/third_party/attrs/.github/workflows/ci.yml

raw
1 ---
2 name: CI
3
4 on:
5 merge_group:
6 push:
7 branches: [main]
8 tags: ["*"]
9 pull_request:
10 branches: [main]
11 workflow_dispatch:
12
13 env:
14 FORCE_COLOR: "1" # Make tools pretty.
15 PIP_DISABLE_PIP_VERSION_CHECK: "1"
16 PIP_NO_PYTHON_VERSION_WARNING: "1"
17 # Use oldest version used in doctests / examples.
18 SETUPTOOLS_SCM_PRETEND_VERSION: "19.2.0"
19
20 permissions: {}
21
22 jobs:
23 tests:
24 name: Tests & Mypy on ${{ matrix.python-version }}
25 runs-on: ubuntu-latest
26
27 strategy:
28 fail-fast: false
29 matrix:
30 python-version:
31 - "3.7"
32 - "3.8"
33 - "3.9"
34 - "3.10"
35 - "3.11"
36 - "3.12"
37 # - "pypy-3.7"
38 - "pypy-3.8"
39 - "pypy-3.9"
40 - "pypy-3.10"
41
42 steps:
43 - uses: actions/checkout@v4
44 - uses: actions/setup-python@v4
45 with:
46 python-version: ${{ matrix.python-version }}
47 allow-prereleases: true
48 cache: pip
49
50 - name: Prepare tox
51 run: |
52 V=${{ matrix.python-version }}
53
54 if [[ "$V" = pypy-* ]]; then
55 V=pypy3
56 IS_PYPY=1
57 else
58 V=py$(echo $V | tr -d .)
59 IS_PYPY=0
60 fi
61
62 echo IS_PYPY=$IS_PYPY >>$GITHUB_ENV
63 echo TOX_PYTHON=$V >>$GITHUB_ENV
64
65 python -Im pip install tox
66
67 - run: python -Im tox run -e ${{ env.TOX_PYTHON }}-tests
68 - run: python -Im tox run -e ${{ env.TOX_PYTHON }}-mypy
69 if: env.IS_PYPY == '0' && matrix.python-version != '3.7'
70
71 - name: Upload coverage data
72 uses: actions/upload-artifact@v3
73 with:
74 name: coverage-data
75 path: .coverage.*
76 if-no-files-found: ignore
77
78 coverage:
79 name: Combine & check coverage.
80 runs-on: ubuntu-latest
81 needs: tests
82
83 steps:
84 - uses: actions/checkout@v4
85 - uses: actions/setup-python@v4
86 with:
87 python-version-file: .python-version-default
88 cache: pip
89
90 - name: Download coverage data
91 uses: actions/download-artifact@v3
92 with:
93 name: coverage-data
94
95 - name: Combine coverage & fail if it's <100%.
96 run: |
97 python -Im pip install coverage[toml]
98
99 python -Im coverage combine
100 python -Im coverage html --skip-covered --skip-empty
101
102 # Report and write to summary.
103 python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
104
105 # Report again and fail if under 100%.
106 python -Im coverage report --fail-under=100
107
108 - name: Upload HTML report if check failed.
109 uses: actions/upload-artifact@v3
110 with:
111 name: html-report
112 path: htmlcov
113 if: ${{ failure() }}
114
115 docs:
116 name: Build docs & run doctests
117 runs-on: ubuntu-latest
118 steps:
119 - uses: actions/checkout@v4
120 - uses: actions/setup-python@v4
121 with:
122 # Keep in sync with tox/docs and .readthedocs.yaml.
123 python-version: "3.12"
124 cache: pip
125
126 - run: python -Im pip install tox
127 - run: python -Im tox run -e docs,changelog
128
129 pyright:
130 name: Check types using pyright
131 runs-on: ubuntu-latest
132 steps:
133 - uses: actions/checkout@v4
134 - uses: actions/setup-python@v4
135 with:
136 python-version-file: .python-version-default
137 cache: pip
138
139 - run: python -Im pip install tox
140 - run: python -Im tox run -e pyright
141
142 install-dev:
143 name: Verify dev env
144 runs-on: ${{ matrix.os }}
145 strategy:
146 matrix:
147 os: [ubuntu-latest, windows-latest]
148
149 steps:
150 - uses: actions/checkout@v4
151 - uses: actions/setup-python@v4
152 with:
153 python-version-file: .python-version-default
154 cache: pip
155
156 - name: Install in dev mode & import
157 run: |
158 python -Im pip install -e .[dev]
159 python -Ic 'import attr; print(attr.__version__)'
160 python -Ic 'import attrs; print(attrs.__version__)'
161
162 # Ensure everything required is passing for branch protection.
163 required-checks-pass:
164 if: always()
165
166 needs:
167 - coverage
168 - docs
169 - install-dev
170 - pyright
171
172 runs-on: ubuntu-latest
173
174 steps:
175 - name: Decide whether the needed jobs succeeded or failed
176 uses: re-actors/alls-green@release/v1
177 with:
178 jobs: ${{ toJSON(needs) }}