-
Notifications
You must be signed in to change notification settings - Fork 11
134 lines (113 loc) · 3.51 KB
/
ci.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
130
131
132
133
134
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# run every morning at 10am Pacific Time
- cron: '0 17 * * *'
name: ci
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-10-07
jobs:
env:
runs-on: ubuntu-latest
outputs:
rust-versions: ${{ steps.definitions.outputs.versions }}
msrv: ${{ steps.definitions.outputs.msrv }}
steps:
- uses: actions/checkout@v4
- name: Evaluate definitions
id: definitions
run: |
export MSRV=$(rustup show | awk 'NF' | awk 'END{print $2}')
echo "msrv=$MSRV" >> "$GITHUB_OUTPUT"
export RAW_VERSIONS="stable beta $RUST_NIGHTLY_TOOLCHAIN $MSRV"
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.')
echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT"
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rustfmt toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal --component rustfmt
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- name: Install clippy toolchain
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup override set stable
- name: Run checks
run: |
cargo xtask checks --rustfmt-toolchain ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: camshaft/rust-cache@v1
- uses: camshaft/install@v1
with:
crate: cargo-udeps
- name: Cache node_modules
uses: actions/[email protected]
continue-on-error: true
with:
path: duvet/www/node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }}
- name: Build script.js
run: |
cargo xtask build
- name: Run cargo udeps
run: cargo udeps --workspace --all-targets
env:
RUSTC_WRAPPER: ""
test:
runs-on: ${{ matrix.os }}
needs: env
strategy:
matrix:
rust: ${{ fromJson(needs.env.outputs.rust-versions) }}
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Cache node_modules
uses: actions/[email protected]
continue-on-error: true
with:
path: duvet/www/node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('duvet/www/package-lock.json') }}
- name: Run tests
run: |
cargo xtask test
action: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
- name: duvet help
run: duvet --help