Skip to content

Commit df92d8c

Browse files
committed
Check previous versions as well
1 parent 09de85a commit df92d8c

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

.github/workflows/rust-target.yml

+25-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,26 @@ on:
1212
- main
1313

1414
jobs:
15+
define-matrix:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
matrix: ${{ steps.define-matrix.outputs.matrix }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Define Matrix
24+
id: define-matrix
25+
run: |
26+
matrix=$(python ci/set_versions.py)
27+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
28+
1529
test:
1630
runs-on: ubuntu-latest
31+
needs: [define-matrix]
1732
strategy:
1833
fail-fast: false
19-
matrix:
20-
rust-version: ["1.33", "1.36", "1.40", "1.43", "1.47", "1.59", "1.64", "1.68", "1.71", "1.73", "1.77", "nightly"]
34+
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
2135
steps:
2236
- uses: actions/checkout@v4
2337

@@ -33,11 +47,14 @@ jobs:
3347
3448
- name: Check headers
3549
run: |
36-
HEADERS=$(rg -l '\-\-rust-target[\s=]${{matrix.rust-version}}' bindgen-tests/tests/headers/ | cut -d '/' -f 4 | cut -d '.' -f 1)
50+
TARGET_VERSIONS=$(echo '${{matrix.target-versions}}' | jq ".[]" | tr -d '"')
51+
for TARGET_VERSION in $TARGET_VERSIONS; do
52+
echo "Running checks for target version $TARGET_VERSION"
53+
HEADERS=$(rg -l '\-\-rust-target[\s=]$TARGET_VERSION' bindgen-tests/tests/headers/ | cut -d '/' -f 4 | cut -d '.' -f 1)
3754
38-
for HEADER in $HEADERS; do
39-
FILE="bindgen-tests/tests/expectations/tests/$HEADER.rs"
40-
echo "Checking $FILE"
41-
rustup run ${{matrix.rust-version}} rustc --edition=2018 --crate-type=rlib --emit=metadata $FILE
55+
for HEADER in $HEADERS; do
56+
FILE="bindgen-tests/tests/expectations/tests/$HEADER.rs"
57+
echo "Checking $FILE"
58+
rustup run ${{matrix.rust-version}} rustc --edition=2018 --crate-type=rlib --emit=metadata $FILE
59+
done
4260
done
43-

ci/set_versions.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import json
2+
3+
versions = '["1.33", "1.36", "1.40", "1.43", "1.47", "1.59", "1.64", "1.68", "1.71", "1.73", "1.77", "nightly"]'
4+
5+
versions = json.loads(versions)
6+
7+
print(json.dumps([{"rust-version": version, "target-versions": versions[0:i+1] } for (i, version) in enumerate(versions)]))

0 commit comments

Comments
 (0)