-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (143 loc) · 5.47 KB
/
Copy pathci.yml
File metadata and controls
170 lines (143 loc) · 5.47 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: CI
permissions:
contents: read
concurrency:
group: >
ci-${{ github.workflow }}-${{
github.event_name == 'pull_request' &&
github.event.pull_request.number ||
github.ref
}}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Disable Git autocrlf on Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
target: ${{ matrix.target }}
cache: true
cache-bin: false
# toolchain, components, etc. are specified in rust-toolchain.toml
- name: Set up just
uses: ./.github/actions/setup-just
- name: Export tool versions
id: tool_versions
shell: bash
run: |
set -euo pipefail
resolve_version() {
local name="$1"
local value
if ! value="$(just --evaluate "$name")"; then
echo "::error::Failed to resolve $name from justfile" >&2
return 1
fi
if [[ -z "$value" ]]; then
echo "::error::Resolved empty $name from justfile" >&2
return 1
fi
printf '%s\n' "$value"
}
cargo_machete_version="$(resolve_version cargo_machete_version)"
cargo_nextest_version="$(resolve_version cargo_nextest_version)"
dprint_version="$(resolve_version dprint_version)"
rumdl_version="$(resolve_version rumdl_version)"
taplo_version="$(resolve_version taplo_version)"
typos_version="$(resolve_version typos_version)"
uv_version="$(resolve_version uv_version)"
zizmor_version="$(resolve_version zizmor_version)"
{
echo "CARGO_MACHETE_VERSION=$cargo_machete_version"
echo "CARGO_NEXTEST_VERSION=$cargo_nextest_version"
echo "DPRINT_VERSION=$dprint_version"
echo "RUMDL_VERSION=$rumdl_version"
echo "TAPLO_VERSION=$taplo_version"
echo "TYPOS_VERSION=$typos_version"
echo "UV_VERSION=$uv_version"
echo "ZIZMOR_VERSION=$zizmor_version"
} >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: ${{ steps.tool_versions.outputs.UV_VERSION }}
enable-cache: true
- name: Sync Python tooling
run: uv sync --locked --group dev
- name: Install dprint
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: dprint@${{ steps.tool_versions.outputs.DPRINT_VERSION }}
- name: Install rumdl
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: rumdl@${{ steps.tool_versions.outputs.RUMDL_VERSION }}
- name: Install taplo
id: install-taplo
continue-on-error: ${{ matrix.os == 'windows-latest' }}
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: taplo-cli@${{ steps.tool_versions.outputs.TAPLO_VERSION }}
- name: Install taplo on Windows after cached install failure
if: matrix.os == 'windows-latest' && steps.install-taplo.outcome == 'failure'
shell: pwsh
run: cargo install --locked taplo-cli --version $env:TAPLO_VERSION
env:
TAPLO_VERSION: ${{ steps.tool_versions.outputs.TAPLO_VERSION }}
- name: Install typos
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: typos-cli@${{ steps.tool_versions.outputs.TYPOS_VERSION }}
- name: Install zizmor
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: zizmor@${{ steps.tool_versions.outputs.ZIZMOR_VERSION }}
- name: Install cargo-machete
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: cargo-machete@${{ steps.tool_versions.outputs.CARGO_MACHETE_VERSION }}
- name: Install cargo-nextest
uses: taiki-e/cache-cargo-install-action@9ee83daaa7b96a6fab930949ecf1122bba04a389 # v3.0.8
with:
tool: cargo-nextest@${{ steps.tool_versions.outputs.CARGO_NEXTEST_VERSION }}
- name: Run CI checks
run: just ci