forked from HyperSafeD/Sanctifier
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (88 loc) · 2.95 KB
/
Copy pathrust.yml
File metadata and controls
109 lines (88 loc) · 2.95 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
name: Rust CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build-core-tooling-matrix:
name: Build Rust version matrix
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.versions }}
steps:
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Compute last 3 stable Rust versions
id: versions
shell: bash
run: |
stable="$(rustc --version --verbose | sed -n 's/^release: //p')"
major="${stable%%.*}"
remainder="${stable#${major}.}"
minor="${remainder%%.*}"
previous_one=$((minor - 1))
previous_two=$((minor - 2))
if (( previous_two < 0 )); then
echo "Unable to compute previous versions from stable release '${stable}'" >&2
exit 1
fi
versions="$(printf '["%s.%s","%s.%s","%s.%s"]' "$major" "$minor" "$major" "$previous_one" "$major" "$previous_two")"
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
echo "Using Rust versions: ${versions}"
build-core-tooling-compat:
name: Build core tooling (Rust ${{ matrix.rust }})
needs: build-core-tooling-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: ${{ fromJson(needs.build-core-tooling-matrix.outputs.versions) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo registry & build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust }}-
${{ runner.os }}-cargo-
- name: Build sanctifier-core and sanctifier-cli
run: cargo check -p sanctifier-core -p sanctifier-cli
build-and-test:
name: Build & Test sanctifier-cli
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache cargo registry & build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --check
- name: Run Clippy
- name: Build release binary
run: cargo build --release --locked -p sanctifier-cli