-
Notifications
You must be signed in to change notification settings - Fork 73
177 lines (169 loc) · 5.43 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
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
171
172
173
174
175
176
177
name: CI
on:
workflow_dispatch:
push:
branches: [master]
paths-ignore:
- '**/*.md'
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
jobs:
cargo-test:
name: Cargo Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: false
save-cache: true
shared-key: x86-cargo-test-ubuntu-latest-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i
- name: Clean Sailfish cache
run: rm -rf target/debug/build/sailfish-*
- run: cargo test
build:
name: Mako Build
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: true
save-cache: true
shared-key: mako-build-${{ matrix.os }}-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i
- name: Build
run: pnpm build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.os }}
path: |
./packages/mako/*.node
./packages/mako/binding.*
./packages/mako/dist
if-no-files-found: error
test_e2e:
name: E2E
needs: build
strategy:
fail-fast: false
matrix:
script: [ "test:e2e", "test:hmr", "test:umi" ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: |
pnpm i
pnpm playwright install chromium
- name: Download bindings
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.os }}
path: packages/mako/
- name: LS
run: ls -l ./packages/mako
- name: Test E2E
env:
RUST_BACKTRACE: full
run: pnpm ${{ matrix.script }}
lint:
name: Clippy
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: true
shared-key: x86-cargo-test-ubuntu-latest-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}
- name: Clippy
run: cargo clippy --locked -- -D warnings
format:
name: Format
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: ./.github/actions/rustup
with:
fmt: true
restore-cache: false
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i
- run: pnpm biome:check
- run: cargo fmt --all -- --check
- name: Install Taplo CLI
uses: ./.github/actions/binstall
with:
packages: [email protected]
- run: taplo format --check
typos:
name: Spell Check
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
with:
files: .