-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (123 loc) · 3.84 KB
/
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
126
127
128
129
name: build
# This should ensure that the workflow won't run on `dev-*` branches, but will
# otherwise execute on any other branch and any pull request (including from dev
# branches).
on:
push:
branches-ignore:
- 'dev-*'
pull_request:
branches:
- '*'
env:
# A fixed version used for testing, so that the builds don't
# spontaneously break after a few years.
# Make sure to update this from time to time.
RUST_VERSION: "1.75.0"
jobs:
# Check formatting
fmt:
name: Rustfmt
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- run: cargo fmt --all -- --check
# Run basic code validity check.
check:
needs: fmt
name: Check
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- run: cargo check --all-features
# Run all tests
test:
needs: check
name: Test Suite
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- run: wget https://github.com/sbmlteam/sbml-test-suite/releases/download/3.4.0/syntactic_tests.v3.4.0.zip
- run: unzip syntactic_tests.v3.4.0.zip
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- run: cargo test --all-features --release
# Check code style
clippy:
needs: check
name: Clippy
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- run: cargo clippy --all-features
# Run SBML test suite
sbml-test-suite:
needs: check
name: SBML Test Suite
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- run: wget https://github.com/sbmlteam/sbml-test-suite/releases/download/3.4.0/syntactic_tests.v3.4.0.zip
- run: unzip syntactic_tests.v3.4.0.zip
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- run: cargo run --release --example test-suite-syntactic -- `cat validated-rules.txt`
- run: zip test-results.zip ./test_suite_error.txt ./test_suite_info.txt ./test_suite_warning.txt
if: always()
- uses: actions/upload-artifact@v4
if: always()
with:
name: results
path: ./test-results.zip
# Compute code coverage
codecov:
needs: test
name: Code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Should allow tarpaulin to also measure coverage for the SBML test suite.
- run: wget https://github.com/sbmlteam/sbml-test-suite/releases/download/3.4.0/syntactic_tests.v3.4.0.zip
- run: unzip syntactic_tests.v3.4.0.zip
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
# Install action using cargo-binstall, which is faster because we don't have to compile tarpaulin every time.
- uses: taiki-e/install-action@v2
with:
tool: cargo-tarpaulin
- run: cargo tarpaulin --verbose --lib --examples --release --all-features --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
path: cobertura.xml