-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 2.22 KB
/
Copy pathci.yml
File metadata and controls
73 lines (61 loc) · 2.22 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
name: CI
on:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
checks:
name: Rust ${{ matrix.toolchain }} / ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
toolchain: stable
- runner: macos-latest
toolchain: stable
- runner: windows-latest
toolchain: stable
- runner: ubuntu-latest
toolchain: "1.88.0"
steps:
- name: Checkout sources
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- name: Cache cargo build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ci-${{ matrix.toolchain }}
- name: Install actionlint
if: matrix.runner == 'ubuntu-latest' && matrix.toolchain == 'stable'
run: |
archive="$RUNNER_TEMP/actionlint.tar.gz"
curl --proto '=https' --tlsv1.2 --location --fail --show-error --silent --retry 5 \
--output "$archive" \
https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 $archive" | sha256sum --check
tar -xzf "$archive" -C "$RUNNER_TEMP" actionlint
mkdir -p "$HOME/.local/bin"
install -m 0755 "$RUNNER_TEMP/actionlint" "$HOME/.local/bin/actionlint"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Validate workflows
if: matrix.runner == 'ubuntu-latest' && matrix.toolchain == 'stable'
run: actionlint
- name: Check formatting
if: matrix.runner == 'ubuntu-latest' && matrix.toolchain == 'stable'
run: cargo fmt --all -- --check
- name: Run Clippy
if: matrix.runner == 'ubuntu-latest' && matrix.toolchain == 'stable'
run: cargo clippy --all-targets --locked -- -D warnings
- name: Run tests
run: cargo test --locked