Files
loot-condition-interpreter/.github/workflows/ci.yml
T
Oliver Hamlet f7db75bfea Stop using 7z binaries in test cases
They're not reliably available and are now causing CI failures. Instead
use libloot for the test cases that used 7z, and update it because older
versions of libloot incorrectly use "ProductVERSION " instead of
"ProductVersion".
2022-11-09 00:04:38 +00:00

140 lines
4.7 KiB
YAML

name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
rustfmt:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install Rustfmt
run: |
rustup component add rustfmt
rustfmt --version
- name: Check formatting
run: cargo fmt --all -- --check
windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Prepare test resources
run: |
cd tests
(New-Object Net.WebClient).DownloadFile('https://github.com/WrinklyNinja/testing-plugins/archive/1.4.0.zip', "$PWD/1.4.0.zip")
7z x 1.4.0.zip
mv testing-plugins-1.4.0 testing-plugins
(New-Object Net.WebClient).DownloadFile('https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win32.7z', "$PWD/libloot_win32.7z")
7z x libloot_win32.7z
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win32 libloot_win32
(New-Object Net.WebClient).DownloadFile('https://github.com/loot/libloot/releases/download/0.18.2/libloot-0.18.2-0-gb1a9e31_0.18.2-win64.7z', "$PWD/libloot_win64.7z")
7z x libloot_win64.7z
mv libloot-0.18.2-0-gb1a9e31_0.18.2-win64 libloot_win64
(New-Object Net.WebClient).DownloadFile('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', "$PWD/loot_api_python.7z")
7z x loot_api_python.7z
mv loot_api_python-4.0.2-0-gd356ac2_master-python2.7-win32 loot_api_python
cd ..
- name: Build and run tests
run: cargo test --all --all-features
# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers
# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest
linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Tarpaulin
run: curl -sL https://github.com/xd009642/tarpaulin/releases/download/0.18.0/cargo-tarpaulin-0.18.0-travis.tar.gz | tar xvz -C $HOME/.cargo/bin
- name: Prepare test resources
run: |
cd tests
wget https://github.com/WrinklyNinja/testing-plugins/archive/1.4.1.tar.gz
tar -xf 1.4.1.tar.gz
mv testing-plugins-1.4.1 testing-plugins
wget 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 libloot_win32
wget 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 libloot_win64
wget 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 loot_api_python
cd ..
- name: Build and run tests with code coverage
run: cargo tarpaulin --workspace --out Lcov --avoid-cfg-tarpaulin
- name: Upload code coverage to Coveralls
uses: coverallsapp/github-action@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers
# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest