-
Notifications
You must be signed in to change notification settings - Fork 19
141 lines (115 loc) · 4.19 KB
/
ci.yml
File metadata and controls
141 lines (115 loc) · 4.19 KB
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
138
139
140
141
name: CI
on:
merge_group:
pull_request:
schedule:
- cron: "0 3 * * 3"
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check-up-to-dateness:
outputs:
is-up-to-date: ${{ steps.main.outputs.is-up-to-date }}
runs-on: ubuntu-latest
steps:
- id: main
uses: trailofbits/check-up-to-dateness@v1
test:
needs: [check-up-to-dateness]
if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true'
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
environment: [ubuntu-latest, macos-latest, windows-latest]
test: [third_party_0, third_party_1, third_party_2, trycmd, other]
include:
- environment: ubuntu-latest
test: ci
runs-on: ${{ matrix.environment }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.avm
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.dylint_drivers/
~/.rustup/toolchains/
target/dylint/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Rustup
run: rustup update
- name: Install CI tools
if: ${{ matrix.test == 'ci' }}
run: |
rustup +nightly component add clippy rustfmt
cargo install cargo-dylint --git=https://github.com/trailofbits/dylint --no-default-features --features=cargo-cli || true
cargo install dylint-link || true
cargo install cargo-hack || true
cargo install cargo-license || true
cargo install cargo-sort || true
cargo install cargo-supply-chain || true
cargo install cargo-udeps --locked || true
cargo install cargo-unmaintained || true
- name: Install testing tools
if: ${{ matrix.test != 'ci' }}
uses: ./.github/actions/install-testing-tools
- name: Install sqlite3 on Ubuntu
if: ${{ matrix.environment == 'ubuntu-latest' }}
run: sudo apt install libsqlite3-dev
- name: Free up space on Ubuntu
if: ${{ matrix.environment == 'ubuntu-latest' }}
run: |
# https://github.com/actions/runner-images/issues/2606#issuecomment-772683150
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
# du -sh /usr/*/* 2>/dev/null | sort -h || true
- name: Disable incremental compilation on Windows
if: ${{ matrix.environment == 'windows-latest' }}
run: echo 'CARGO_INCREMENTAL=0' >> "$GITHUB_ENV"
- name: Enable debug logging
if: ${{ runner.debug == 1 }}
run: echo 'RUST_LOG=debug' >> "$GITHUB_ENV"
- name: Build
run: |
if [[ '${{ matrix.test }}' != 'other' ]]; then
$CARGO_TEST -p necessist --test ${{ matrix.test }}
else
$CARGO_TEST -p necessist --test general
$CARGO_TEST -p necessist-backends
$CARGO_TEST -p necessist-core
fi
env:
CARGO_TEST: cargo test --no-run
- name: Test
run: |
if [[ '${{ matrix.test }}' != 'other' ]]; then
cargo test -p necessist --test ${{ matrix.test }} -- --nocapture
else
cargo test -p necessist --test general
cargo test -p necessist-backends
cargo test -p necessist-core
fi
all-checks:
needs: [test]
# smoelius: From "Defining prerequisite jobs"
# (https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs):
# > If you would like a job to run even if a job it is dependent on did not succeed, use the
# > `always()` conditional expression in `jobs.<job_id>.if`.
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check results
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1