name: CI on: [push, pull_request] env: CARGO_TERM_COLOR: always permissions: contents: read jobs: rustfmt: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Check formatting run: | cargo fmt -- --version cargo fmt --all -- --check clippy: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Run clippy run: | cargo clippy -- --version cargo clippy --workspace --all-targets -- -Dwarnings cargo-vet: runs-on: ubuntu-24.04 env: CARGO_VET_REV: c178261c96c9f820f67817e9c5458db655ddc21f # 0.10.1 steps: - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: ${{ runner.tool_cache }}/cargo-vet key: cargo-vet-bin-${{ env.CARGO_VET_REV }} - name: Add the tool cache directory to the search path run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH - name: Ensure that the tool cache is populated with the cargo-vet binary run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --locked --git https://github.com/mozilla/cargo-vet --rev ${{ env.CARGO_VET_REV }} cargo-vet if: steps.cache-cargo-vet.outputs.cache-hit != 'true' - name: Invoke cargo-vet run: | cargo vet --version cargo vet --locked build: strategy: matrix: os: - windows-2025 - ubuntu-24.04 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v5 - uses: actions/cache@v4 id: cache-cargo with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cbindgen run: cargo install --locked --git https://github.com/mozilla/cbindgen --rev 58c6156b0d91e82abb03c26187b8d18fa4345ce0 cbindgen if: steps.cache-cargo.outputs.cache-hit != 'true' - name: Install cargo-llvm-cov uses: taiki-e/install-action@d6d752794628f1e1fffa3c4d3c8874e06f043d50 # v2.62.15 with: tool: cargo-llvm-cov@0.6.19 - name: Prepare test resources shell: bash run: | mkdir tests fetch() { filename="${1##*/}" curl -sSfLO "$1" sha256sum -c <<< "$2 $filename" 7z x "$filename" } fetch 'https://github.com/Ortham/testing-plugins/archive/1.4.0.zip' 76415050637ab2ce7e5202b707c8f3165e3bf43e88da0c31f20bc638ce5d3a53 mv testing-plugins-1.4.0 tests/testing-plugins fetch 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z' b32d83bd0732cb861de9b80510dfddab6ca8369c4c3f703a693dc667ae3252cb mv libloot-0.18.2-0-gb1a9e31_0.18.2-win32 tests/libloot_win32 fetch 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z' 8119114395e6ccf3d89b7419418e3909e6d7e64a0d594ede56e07c3a396cde73 mv libloot-0.18.2-0-gb1a9e31_0.18.2-win64 tests/libloot_win64 fetch 'https://github.com/loot/loot-api-python/releases/download/4.0.2/loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32.7z' 83a898446b13eb73df002347027c0f5dd8adf9a404c84eca65db5710308ffafc mv loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32 tests/loot_api_python - name: Build and run tests with code coverage run: cargo llvm-cov --workspace --lcov --output-path lcov.info - name: Upload code coverage to Coveralls uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 continue-on-error: true # Need to rebuild the FFI wrapper so that its binary is given a filename # without a hash. - name: Build FFI wrapper shell: bash run: | cargo build --manifest-path ffi/Cargo.toml cbindgen --version cbindgen ffi/ -o ffi/include/loot_condition_interpreter.h - name: Build and run C++ tests shell: bash run: | cmake -B ffi/build ffi cmake --build ffi/build ctest --test-dir ffi/build --output-on-failure