-
Notifications
You must be signed in to change notification settings - Fork 17
146 lines (136 loc) · 5 KB
/
turbo-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
name: Turbo CI
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# this is pretty verbose and repetitive, but github workflows require it
# the first action is commented, most of those comments apply to all actions
# every 'turbo' call is cached and essentially no-op if the inputs match
# tried to make wasm compile conditional, but that turned out to be complex.
# cache should make it decently fast.
# pnpm cached by lock hash
# turbo cached by cargo lock, pnpm lock in that order
# mostly, compiled wasm will restore from turbo cache
# rust cache only used in rust jobs
jobs:
turbo-compile:
name: Compile
uses: ./.github/workflows/compile-wasm.yml
turbo-lint:
name: Lint
runs-on: buildjet-4vcpu-ubuntu-2204
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: lint
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-lint
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm format-check
- run: pnpm turbo lint --cache-dir=.turbo
turbo-build:
name: Build
runs-on: buildjet-2vcpu-ubuntu-2204
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: built
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm turbo build --cache-dir=.turbo
turbo-test:
name: test
runs-on: buildjet-2vcpu-ubuntu-2204
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: tested
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-test
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm turbo test --cache-dir=.turbo
turbo-lint-rust:
name: lint:rust
runs-on: buildjet-16vcpu-ubuntu-2204
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: rust-linted
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-lint:rust
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- run: pnpm turbo download-keys --cache-dir=.turbo
- run: pnpm turbo format-check:rust --cache-dir=.turbo
- run: pnpm turbo lint:rust --cache-dir=.turbo
turbo-test-rust:
name: test:rust
runs-on: buildjet-16vcpu-ubuntu-2204
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: tested
uses: buildjet/cache@v3
with:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-test:rust
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
- uses: browser-actions/setup-firefox@v1
- run: pnpm turbo download-keys --cache-dir=.turbo
- run: pnpm turbo test:rust --cache-dir=.turbo