Skip to content

Improve override plugin tests #139

Improve override plugin tests

Improve override plugin tests #139

Workflow file for this run

name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
TESTING_PLUGINS_VERSION: "1.6.1"
jobs:
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: |
cargo fmt -- --version
cargo fmt --all -- --check
windows:
runs-on: windows-2019
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: Prepare test resources
run: |
(New-Object Net.WebClient).DownloadFile("https://github.com/Ortham/testing-plugins/archive/${env:TESTING_PLUGINS_VERSION}.zip", "$PWD/${env:TESTING_PLUGINS_VERSION}.zip")
7z x "${env:TESTING_PLUGINS_VERSION}.zip"
mv testing-plugins-${env:TESTING_PLUGINS_VERSION} testing-plugins
- 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
cbindgen ffi/ -o ffi/include/esplugin.h
# 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-20.04
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 cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Prepare test resources
run: |
wget https://github.com/Ortham/testing-plugins/archive/$TESTING_PLUGINS_VERSION.tar.gz
tar -xf $TESTING_PLUGINS_VERSION.tar.gz
mv testing-plugins-$TESTING_PLUGINS_VERSION testing-plugins
- 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@v2
# 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
cbindgen ffi/ -o ffi/include/esplugin.h
# 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