-
Notifications
You must be signed in to change notification settings - Fork 10
80 lines (65 loc) · 2.07 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
TESTING_PLUGINS_VERSION: "1.6.2"
jobs:
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: |
cargo fmt -- --version
cargo fmt --all -- --check
build:
strategy:
matrix:
os:
- windows-2019
- ubuntu-20.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 cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
if: startsWith(runner.os, 'Linux')
- name: Prepare test resources
shell: bash
run: |
curl -sSfLO "https://github.com/Ortham/testing-plugins/archive/${{ 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
if: "!startsWith(runner.os, 'Linux')"
- name: Build and run tests with code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
if: startsWith(runner.os, 'Linux')
- name: Upload code coverage to Coveralls
uses: coverallsapp/github-action@v2
if: startsWith(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/esplugin.h
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest