Check supported rust versions on CI #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rust-target | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
branches: | |
- 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: ${{ fromJSON(needs.define-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{matrix.rust-version}} | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install libtinfo5 ripgrep | |
- name: Check headers | |
run: | | |
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 | |
done | |
done |