Repository navigation
build(deps): bump actions/checkout from 6 to 7 #710
This file contains hidden or 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 CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - 0.3-series | |
| concurrency: | |
| group: ${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| RUSTFLAGS: "--cfg=ci_run" | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/ | |
| target/ | |
| key: selene-rust-tests--${{ runner.os }}--${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| selene-rust-tests--${{ runner.os }}-- | |
| - name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run rust tests | |
| run: cargo test --all-features | |
| # ensure that C interfaces are up to date | |
| - uses: extractions/setup-just@v4 | |
| - uses: cargo-bins/cargo-binstall@v1.18.1 | |
| - name: Install cbindgen and cargo-expand | |
| run: | | |
| cargo binstall cbindgen --no-confirm --version 0.28 | |
| cargo binstall cargo-expand --no-confirm --version 1.0 | |
| - name: Generate bindings | |
| run: | | |
| just generate-bindings | |
| - name: Compile selene-core C headers | |
| run: | | |
| headers="core_types error_model runtime simulator" | |
| for header in ${headers}; do | |
| printf '#include <selene/%s.h>\n' "${header}" | | |
| cc -x c -std=c17 -pedantic-errors -Wall -Wextra -Werror \ | |
| -fsyntax-only -I selene-core/c/include - | |
| printf '#include <selene/%s.h>\n' "${header}" | | |
| c++ -x c++ -std=c++20 -pedantic-errors -Wall -Wextra -Werror \ | |
| -fsyntax-only -I selene-core/c/include - | |
| done | |
| all_headers='#include <selene/core_types.h>\n#include <selene/error_model.h>\n#include <selene/runtime.h>\n#include <selene/simulator.h>\n' | |
| printf '%b' "${all_headers}" | | |
| cc -x c -std=c17 -pedantic-errors -Wall -Wextra -Werror \ | |
| -fsyntax-only -I selene-core/c/include - | |
| printf '%b' "${all_headers}" | | |
| c++ -x c++ -std=c++20 -pedantic-errors -Wall -Wextra -Werror \ | |
| -fsyntax-only -I selene-core/c/include - | |
| - name: Ensure no diff has been generated | |
| run: | | |
| diff_output=$(git diff); | |
| if [ -n "${diff_output}" ]; then | |
| echo "Current selene bindings are inconsistent with generated bindings."; | |
| echo "Please run 'just generate-bindings' and commit the changes"; | |
| echo "Diff:"; | |
| echo "============================================="; | |
| echo "${diff_output}"; | |
| echo "============================================="; | |
| exit 1; | |
| fi |