-
Notifications
You must be signed in to change notification settings - Fork 41
125 lines (101 loc) · 3.46 KB
/
rust-build.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
#
# Copyright © 2020-present Peter M. Stahl [email protected]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Rust Build
on:
push:
branches:
- main
paths:
- 'Cargo.lock'
- 'Cargo.toml'
- 'src/**'
- 'tests/**'
- '**.yml'
pull_request:
branches:
- main
paths:
- 'Cargo.lock'
- 'Cargo.toml'
- 'src/**'
- 'tests/**'
- '**.yml'
jobs:
rust-build:
name: Rust on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
name: Linux Binary 64-Bit
- os: macos-latest
name: MacOS Binary 64-Bit
- os: windows-latest
name: Windows Binary 64-Bit
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install wasm-pack
if: ${{ matrix.os == 'macos-latest' }}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Enable Safari web driver
if: ${{ matrix.os == 'macos-latest' }}
run: sudo safaridriver --enable
- name: Store or retrieve cargo caches
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: Build library in debug mode
run: cargo build --locked
- name: Build binary in debug mode
run: cargo build --locked --bin accuracy_reports --features accuracy-reports
- name: Test in debug mode
run: cargo test
- name: Run WASM integration tests on NodeJS
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --node
- name: Run WASM integration tests in Chrome
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --chrome
- name: Run WASM integration tests in Firefox
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --firefox
- name: Run WASM integration tests in Safari
if: ${{ matrix.os == 'macos-latest' }}
run: wasm-pack test --headless --safari
coverage-report:
name: Coverage Report
needs: rust-build
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Generate coverage report
run: cargo +nightly tarpaulin --lib --ignore-config --ignore-panics --ignore-tests --exclude-files src/python.rs src/script.rs src/wasm.rs src/bin/accuracy_reports.rs --verbose --timeout 120 --out xml
- name: Upload coverage report
uses: codecov/codecov-action@v3