Skip to content

Commit

Permalink
Check previous versions as well
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Nov 22, 2024
1 parent 09de85a commit df92d8c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/rust-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@ on:
- main

jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.define-matrix.outputs.matrix }}

steps:
- uses: actions/checkout@v4

- name: Define Matrix
id: define-matrix
run: |
matrix=$(python ci/set_versions.py)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: [define-matrix]
strategy:
fail-fast: false
matrix:
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"]
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -33,11 +47,14 @@ jobs:
- name: Check headers
run: |
HEADERS=$(rg -l '\-\-rust-target[\s=]${{matrix.rust-version}}' bindgen-tests/tests/headers/ | cut -d '/' -f 4 | cut -d '.' -f 1)
TARGET_VERSIONS=$(echo '${{matrix.target-versions}}' | jq ".[]" | tr -d '"')
for TARGET_VERSION in $TARGET_VERSIONS; do
echo "Running checks for target version $TARGET_VERSION"
HEADERS=$(rg -l '\-\-rust-target[\s=]$TARGET_VERSION' bindgen-tests/tests/headers/ | cut -d '/' -f 4 | cut -d '.' -f 1)
for HEADER in $HEADERS; do
FILE="bindgen-tests/tests/expectations/tests/$HEADER.rs"
echo "Checking $FILE"
rustup run ${{matrix.rust-version}} rustc --edition=2018 --crate-type=rlib --emit=metadata $FILE
for HEADER in $HEADERS; do
FILE="bindgen-tests/tests/expectations/tests/$HEADER.rs"
echo "Checking $FILE"
rustup run ${{matrix.rust-version}} rustc --edition=2018 --crate-type=rlib --emit=metadata $FILE
done
done
7 changes: 7 additions & 0 deletions ci/set_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import json

versions = '["1.33", "1.36", "1.40", "1.43", "1.47", "1.59", "1.64", "1.68", "1.71", "1.73", "1.77", "nightly"]'

versions = json.loads(versions)

print(json.dumps([{"rust-version": version, "target-versions": versions[0:i+1] } for (i, version) in enumerate(versions)]))

0 comments on commit df92d8c

Please sign in to comment.