ci: major overhaul

- Simplify some workflow steps and auxiliary scripts
- Build library using cmake when not cross-compiling
- Try to fetch fixtures from cache first
- Use `actions-rust-lang/setup-rust-toolchain`
This commit is contained in:
ObserverOfTime 2024-10-11 20:10:24 +03:00 committed by Amaan Qureshi
parent 7715001692
commit e8e56255bd
11 changed files with 268 additions and 255 deletions

View file

@ -8,39 +8,44 @@ on:
workflow_call:
jobs:
check_undefined_behaviour:
name: Sanitizer checks
check-undefined-behaviour:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
TREE_SITTER: ${{ github.workspace }}/target/release/tree-sitter
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
- name: Install UBSAN library
run: sudo apt-get update -y && sudo apt-get install -y libubsan1
- name: Install UBSAN library
run: sudo apt-get update -y && sudo apt-get install -y libubsan1
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- run: cargo build --release
- run: cargo xtask fetch-fixtures
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: ./.github/actions/cache
id: cache
- name: Build project
run: cargo build --release
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: cargo xtask generate-fixtures
- name: Cache fixtures
uses: ./.github/actions/cache
id: cache
- name: Run main tests with undefined behaviour sanitizer (UBSAN)
env:
CFLAGS: -fsanitize=undefined
RUSTFLAGS: ${{ env.RUSTFLAGS }} -lubsan
run: cargo test -- --test-threads 1
- name: Fetch fixtures
run: cargo xtask fetch-fixtures
- name: Run main tests with address sanitizer (ASAN)
env:
ASAN_OPTIONS: verify_asan_link_order=0
CFLAGS: -fsanitize=address
RUSTFLAGS: ${{ env.RUSTFLAGS }} -lasan --cfg sanitizing
run: cargo test -- --test-threads 1
- name: Generate fixtures
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: cargo xtask generate-fixtures
- name: Run main tests with undefined behaviour sanitizer (UBSAN)
run: cargo test -- --test-threads 1
env:
CFLAGS: -fsanitize=undefined
RUSTFLAGS: ${{ env.RUSTFLAGS }} -lubsan
- name: Run main tests with address sanitizer (ASAN)
run: cargo test -- --test-threads 1
env:
ASAN_OPTIONS: verify_asan_link_order=0
CFLAGS: -fsanitize=address
RUSTFLAGS: ${{ env.RUSTFLAGS }} -lasan --cfg sanitizing