-
Notifications
You must be signed in to change notification settings - Fork 20
220 lines (220 loc) Β· 8.07 KB
/
Copy pathtox_toml_fmt_test.yaml
File metadata and controls
220 lines (220 loc) Β· 8.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: π§ͺ tox-toml-fmt
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
name: π changes
runs-on: ubuntu-latest
outputs:
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }}
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: π Check for changes
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
run:
- 'toml-doc/**'
- 'common/**'
- 'toml-fmt-common/**'
- 'tox-rules/**'
- 'tox-toml-fmt/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/tox_toml_fmt_test.yaml'
clippy:
name: π clippy
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: clippy
- name: π Run Clippy
run: cargo clippy -p tox-toml-fmt -p tox-rules --locked --all-targets -- -D warnings
fmt:
name: π¨ fmt
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: rustfmt
- name: π¨ Check formatting
run: cargo fmt -p tox-toml-fmt -p tox-rules --check
build:
name: π¨ build
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: π¨ Build
run: cargo build -p tox-toml-fmt --locked
test:
name: β
test
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
environment: test
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: llvm-tools-preview
- name: π¦ Install cargo-llvm-cov and cargo-nextest
uses: taiki-e/install-action@b6ff580856c41316412a0b9b60540fbc6f8c82cc # v2.86.7
with:
tool: cargo-llvm-cov,cargo-nextest
- name: β
Run tests with coverage
run: cargo llvm-cov nextest -p tox-toml-fmt --no-default-features --locked --fail-under-lines 100 --codecov --output-path coverage.json
- name: π€ Upload coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.json
flags: tox-toml-fmt
# the tox rules are a crate of their own, so they prove their own coverage rather than leaning
# on the formatter that ships them
- name: β
Run the tox rule tests with coverage
run: cargo llvm-cov nextest -p tox-rules --no-default-features --locked --fail-under-lines 100 --codecov --output-path tox-rules.json
- name: π€ Upload the tox rule coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tox-rules.json
flags: tox-rules
py:
name: π ${{ matrix.py }} @ ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py: ["3.15", "3.15t", "3.14", "3.14t", "3.13", "3.12", "3.11", "3.10"]
os: [ubuntu-24.04, windows-2025, macos-15]
defaults:
run:
working-directory: tox-toml-fmt
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: π¦ Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: π§ Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: π Install Python ${{ matrix.py }}
if: matrix.py != '3.14'
run: uv python install --python-preference only-managed ${{ matrix.py }}
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: π Generate README.rst
run: tox run -e readme
working-directory: tox-toml-fmt
- name: π Generate pyproject-fmt README.rst
run: tox run -e readme
working-directory: pyproject-fmt
- name: π§ Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
- name: β
Run tests
run: tox run --skip-pkg-install -e ${{ matrix.py }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
check:
name: π ${{ matrix.env }}
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
env: [type, dev, pkg_meta, pkg_sdist]
defaults:
run:
working-directory: tox-toml-fmt
steps:
- name: π₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: π¦ Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: π§ Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: π¦ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: π Generate README.rst
run: tox run -e readme
working-directory: tox-toml-fmt
- name: π Generate pyproject-fmt README.rst
run: tox run -e readme
working-directory: pyproject-fmt
- name: π§ Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
- name: β
Run tests
run: tox run --skip-pkg-install -e ${{ matrix.env }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
all-pass:
name: β
tox-toml-fmt
if: always()
needs: [changes, clippy, fmt, build, test, py, check]
runs-on: ubuntu-latest
steps:
- name: Decide whether all jobs passed or were skipped
run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "Some jobs failed or were canceled"
exit 1
fi
echo "All jobs passed or were skipped"