-
Notifications
You must be signed in to change notification settings - Fork 21
135 lines (111 loc) · 4.1 KB
/
ci.yml
File metadata and controls
135 lines (111 loc) · 4.1 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
name: CI
permissions:
# Doing it explicitly because the default permission only includes metadata: read.
contents: read
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
push:
branches:
- main
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
defaults:
run:
shell: bash
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: namespace-profile-mac-default
target: aarch64-apple-darwin
- os: namespace-profile-mac-default
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
submodules: true
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: test
components: clippy
- run: rustup target add ${{ matrix.target }}
- run: rustup target add x86_64-unknown-linux-musl
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: pip install cargo-zigbuild
if: ${{ matrix.os == 'ubuntu-latest' }}
- run: cargo check --locked --all-targets --all-features --target ${{ matrix.target }}
env:
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
- name: Clippy
id: clippy
continue-on-error: true
run: cargo clippy --all-targets --all-features -- -D warnings
# Set up node and pnpm for running tests
# For x86_64-apple-darwin, use x64 node for fspy tests that verify Node.js fs accesses
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version-file: .node-version
architecture: x64
if: ${{ matrix.target == 'x86_64-apple-darwin' }}
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
if: ${{ matrix.target != 'x86_64-apple-darwin' }}
# `pnpm install` prepares test bins used in snapshot tests
# Must run after setup-node so correct native binaries are installed
- run: pnpm install
- run: cargo test --target ${{ matrix.target }}
if: ${{ matrix.os != 'ubuntu-latest' }}
- run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Check clippy result
if: ${{ steps.clippy.outcome == 'failure' }}
run: exit 1
fmt:
name: Format and Check Deps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
submodules: true
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: fmt
tools: dprint,cargo-shear
components: clippy rust-docs rustfmt
- run: dprint check
- run: cargo shear
- run: cargo fmt --check
- run: RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items
- uses: crate-ci/typos@85f62a8a84f939ae994ab3763f01a0296d61a7ee # v1.36.2
with:
files: .
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
- name: Deduplicate dependencies
run: pnpm dedupe --check
done:
runs-on: ubuntu-latest
needs:
- test
- fmt
steps:
- run: exit 1
# Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}