-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (109 loc) · 4.54 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
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: |
cd tests
(New-Object Net.WebClient).DownloadFile('https://github.com/Ortham/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
cbindgen ffi/ -o ffi/include/loot_condition_interpreter.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: |
cd tests
wget https://github.com/Ortham/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 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/loot_condition_interpreter.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