chore: scaffold standalone stackable-odbc-core repository #2
Workflow file for this run
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: Build and Test | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| merge_group: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_TOOLCHAIN_VERSION: "1.95.0" | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| # odbc-sys links against libodbc/libodbcinst, so the unixODBC dev | |
| # libraries must be present to link the test binaries (no running Driver | |
| # Manager is needed — only the libraries). | |
| - name: Install host dependencies | |
| uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0 | |
| with: | |
| packages: unixodbc-dev | |
| version: ubuntu-latest | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Rust ${{ env.RUST_TOOLCHAIN_VERSION }} toolchain | |
| uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
| with: | |
| toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} | |
| - name: Setup Rust Cache | |
| uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 | |
| - name: Run unit tests | |
| run: cargo test | |
| miri: | |
| name: Miri (undefined behaviour + leaks) | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests] | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Miri requires a nightly toolchain; it cannot run on the pinned stable | |
| # version used everywhere else in this workflow. | |
| - name: Install nightly toolchain with Miri | |
| uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
| with: | |
| toolchain: nightly | |
| components: miri | |
| - name: Setup Rust Cache | |
| uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 | |
| with: | |
| key: miri | |
| # stackable-odbc-core is pure Rust and holds all the raw-pointer | |
| # marshalling, so it is where the undefined-behaviour risk lives. | |
| # | |
| # Proptests are skipped because they take hours under Miri; they run on | |
| # stable in the unit-tests job. | |
| # | |
| # -Zmiri-disable-isolation is needed for the clock/filesystem access the | |
| # test harness performs. Leak reporting is left ON: it is what catches | |
| # handle and descriptor allocations that a teardown path forgets to free. | |
| # `+nightly` is required: rust-toolchain.toml pins 1.95.0, and a bare | |
| # `cargo miri` respects that file regardless of which toolchain was | |
| # installed above. | |
| - name: Run Miri | |
| env: | |
| MIRIFLAGS: -Zmiri-disable-isolation | |
| run: cargo +nightly miri test -p stackable-odbc-core --lib -- --skip proptest | |
| fuzz: | |
| name: Fuzz (ASAN smoke) | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests] | |
| steps: | |
| # The fuzz binaries link stackable-odbc-core, which links libodbc. | |
| - name: Install host dependencies | |
| uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0 | |
| with: | |
| packages: unixodbc-dev | |
| version: ubuntu-latest | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # cargo-fuzz builds with libFuzzer + AddressSanitizer, which require a | |
| # nightly toolchain. The fuzz crate is its own Cargo workspace so the | |
| # pinned stable root build never touches it. | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
| with: | |
| toolchain: nightly | |
| - name: Setup Rust Cache | |
| uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 | |
| with: | |
| key: fuzz | |
| - name: Install cargo-fuzz | |
| uses: taiki-e/install-action@97a5807a604e12de3a13b52d868ebecaeeea757c # v2.75.4 | |
| with: | |
| tool: cargo-fuzz | |
| # A short smoke run per target: long enough to shake out an ASAN overrun | |
| # in the pointer-marshalling paths, short enough for per-PR CI. | |
| - name: Fuzz utf16 | |
| run: cargo +nightly fuzz run utf16 -- -max_total_time=30 | |
| - name: Fuzz column_value | |
| run: cargo +nightly fuzz run column_value -- -max_total_time=30 | |
| # Single required check for branch protection rules. | |
| finished: | |
| name: Finished Build and Test | |
| if: always() | |
| needs: | |
| - unit-tests | |
| - miri | |
| - fuzz | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check job results | |
| run: | | |
| if [[ "${{ needs.unit-tests.result }}" != "success" ]] || | |
| [[ "${{ needs.miri.result }}" != "success" ]] || | |
| [[ "${{ needs.fuzz.result }}" != "success" ]]; then | |
| echo "One or more jobs failed" | |
| exit 1 | |
| fi | |
| echo "All jobs passed" |