mirror of
https://github.com/loot/loot-condition-interpreter.git
synced 2026-07-27 14:16:09 -07:00
105 lines
3.1 KiB
YAML
105 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
rustfmt:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
cargo fmt -- --version
|
|
cargo fmt --all -- --check
|
|
|
|
clippy:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run clippy
|
|
run: |
|
|
cargo clippy -- --version
|
|
cargo clippy --all --all-targets -- -Dwarnings
|
|
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- windows-2019
|
|
- ubuntu-24.04
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/cache@v4
|
|
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 --force cbindgen --version 0.27.0
|
|
|
|
- name: Install cargo-llvm-cov
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
|
if: runner.os == 'Linux'
|
|
|
|
- name: Prepare test resources
|
|
shell: bash
|
|
run: |
|
|
mkdir tests
|
|
|
|
curl -sSfLO 'https://github.com/Ortham/testing-plugins/archive/1.4.0.zip'
|
|
7z x 1.4.0.zip
|
|
mv testing-plugins-1.4.0 tests/testing-plugins
|
|
|
|
curl -sSfLO 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z'
|
|
7z x libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z
|
|
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win32 tests/libloot_win32
|
|
|
|
curl -sSfLO 'https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z'
|
|
7z x libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z
|
|
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win64 tests/libloot_win64
|
|
|
|
curl -sSfLO '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'
|
|
7z x loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32.7z
|
|
mv loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32 tests/loot_api_python
|
|
|
|
- name: Build and run tests
|
|
run: cargo test --workspace
|
|
if: runner.os != 'Linux'
|
|
|
|
- name: Build and run tests with code coverage
|
|
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
|
|
if: runner.os == 'Linux'
|
|
|
|
- name: Upload code coverage to Coveralls
|
|
uses: coverallsapp/github-action@v2
|
|
if: runner.os == 'Linux'
|
|
|
|
# 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 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
|