Skip to content

Commit e1357c5

Browse files
authored
Improve CI times and make merge queue only trigger one CI run (#3755)
* Split ci job into multiple jobs running on github runners * Add permission to build steps * Try running rust build on selfhosted runner * Disable nix setup for self hosted runner * Revert build and only run lint + web build + rust fmt on gh runners * Only build rust tests and ignore branding for frontend lint * Provide stub ts types for running linter without building wasm bundle * Manually install wasm-opt + use cargo-binstall * Only build with shaders for master builds * Revert splitting of lint job * Attempt to build with shaders * Explicitly install linux target * Move frontend build back to self hosted runner * Remove whitespace changes * Remove explicit build step
1 parent 9bf3605 commit e1357c5

File tree

2 files changed

+133
-70
lines changed

2 files changed

+133
-70
lines changed

.github/workflows/ci.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: "CI"
2+
3+
on:
4+
pull_request: {}
5+
merge_group: {}
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
# Rust format check on GitHub runner
12+
rust-fmt:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: 📥 Clone and checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: 🚦 Check if CI can be skipped
19+
id: skip-check
20+
uses: cariad-tech/merge-queue-ci-skipper@main
21+
22+
- name: 🦀 Install the latest Rust
23+
if: steps.skip-check.outputs.skip-check != 'true'
24+
uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: rustfmt
27+
28+
- name: 🔬 Check Rust formatting
29+
if: steps.skip-check.outputs.skip-check != 'true'
30+
run: cargo fmt --all -- --check
31+
32+
# License compatibility check on GitHub runner
33+
cargo-deny:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: 📥 Clone and checkout repository
37+
uses: actions/checkout@v3
38+
39+
- name: 📜 Check crate license compatibility for root workspace
40+
uses: EmbarkStudios/cargo-deny-action@v2
41+
with:
42+
command: check bans licenses sources
43+
44+
- name: 📜 Check crate license compatibility for /libraries/rawkit
45+
uses: EmbarkStudios/cargo-deny-action@v2
46+
with:
47+
command: check bans licenses sources
48+
manifest-path: libraries/rawkit/Cargo.toml
49+
50+
# Full build and tests on self-hosted runner
51+
build:
52+
runs-on: self-hosted
53+
permissions:
54+
contents: write
55+
deployments: write
56+
pull-requests: write
57+
actions: write
58+
env:
59+
RUSTC_WRAPPER: /usr/bin/sccache
60+
CARGO_INCREMENTAL: 0
61+
SCCACHE_DIR: /var/lib/github-actions/.cache
62+
63+
steps:
64+
- name: 📥 Clone and checkout repository
65+
uses: actions/checkout@v3
66+
67+
- name: 🚦 Check if CI can be skipped
68+
id: skip-check
69+
uses: cariad-tech/merge-queue-ci-skipper@main
70+
71+
- name: 🗑 Clear wasm-bindgen cache
72+
if: steps.skip-check.outputs.skip-check != 'true'
73+
run: rm -r ~/.cache/.wasm-pack || true
74+
75+
- name: 🟢 Install the latest Node.js
76+
if: steps.skip-check.outputs.skip-check != 'true'
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: 'latest'
80+
81+
- name: 🚧 Install build dependencies
82+
if: steps.skip-check.outputs.skip-check != 'true'
83+
run: |
84+
cd frontend
85+
npm run setup
86+
87+
- name: 🦀 Install the latest Rust
88+
if: steps.skip-check.outputs.skip-check != 'true'
89+
run: |
90+
rustup update stable
91+
92+
- name: 🦀 Fetch Rust dependencies
93+
if: steps.skip-check.outputs.skip-check != 'true'
94+
run: |
95+
cargo fetch --locked
96+
97+
- name: 🌐 Build Graphite web code
98+
if: steps.skip-check.outputs.skip-check != 'true'
99+
env:
100+
NODE_ENV: production
101+
run: |
102+
cd frontend
103+
mold -run npm run build
104+
105+
- name: 📤 Publish to Cloudflare Pages
106+
if: steps.skip-check.outputs.skip-check != 'true'
107+
uses: cloudflare/pages-action@1
108+
continue-on-error: true
109+
with:
110+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
111+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
112+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
113+
projectName: graphite-dev
114+
directory: frontend/dist
115+
116+
- name: 👕 Lint Graphite web formatting
117+
if: steps.skip-check.outputs.skip-check != 'true'
118+
env:
119+
NODE_ENV: production
120+
run: |
121+
cd frontend
122+
npm run lint
123+
124+
- name: 🧪 Run Rust tests
125+
if: steps.skip-check.outputs.skip-check != 'true'
126+
env:
127+
RUSTFLAGS: -Dwarnings
128+
run: |
129+
mold -run cargo test --all-features
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
name: "Editor: Dev & CI"
1+
name: "Deploy Master"
22

33
on:
44
push:
55
branches:
66
- master
7-
pull_request: {}
8-
merge_group: {}
7+
98
env:
109
CARGO_TERM_COLOR: always
1110
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.art" data-api="https://graphite.art/visit/event" src="https://graphite.art/visit/script.hash.js"></script>
1211

1312
jobs:
14-
build:
13+
deploy:
1514
runs-on: self-hosted
1615
permissions:
1716
contents: write
1817
deployments: write
19-
pull-requests: write
2018
actions: write
2119
env:
2220
RUSTC_WRAPPER: /usr/bin/sccache
@@ -33,7 +31,7 @@ jobs:
3331
- name: 🟢 Install the latest Node.js
3432
uses: actions/setup-node@v4
3533
with:
36-
node-version: "latest"
34+
node-version: 'latest'
3735

3836
- name: 🚧 Install build dependencies
3937
run: |
@@ -42,21 +40,10 @@ jobs:
4240
4341
- name: 🦀 Install the latest Rust
4442
run: |
45-
echo "Initial system version:"
46-
rustc --version
4743
rustup update stable
48-
echo "Latest updated version:"
49-
rustc --version
50-
51-
- name: 🦀 Fetch Rust dependencies
52-
run: |
53-
echo "If it fails here, the committed Cargo.lock may be out of date"
54-
cargo fetch --locked
5544
5645
- name: ✂ Replace template in <head> of index.html
5746
run: |
58-
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
59-
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
6047
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
6148
6249
- name: 🌐 Build Graphite web code
@@ -78,7 +65,6 @@ jobs:
7865
directory: frontend/dist
7966

8067
- name: 💬 Comment build link URL to commit hash page on GitHub
81-
if: github.ref == 'refs/heads/master'
8268
env:
8369
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8470
run: |
@@ -90,29 +76,7 @@ jobs:
9076
|-|
9177
| ${{ steps.cloudflare.outputs.url }} |"
9278
93-
- name: 👕 Lint Graphite web formatting
94-
env:
95-
NODE_ENV: production
96-
run: |
97-
cd frontend
98-
npm run lint
99-
100-
- name: 🔬 Check Rust formatting
101-
run: |
102-
mold -run cargo fmt --all -- --check
103-
104-
- name: 🦀 Build Rust code
105-
env:
106-
RUSTFLAGS: -Dwarnings
107-
run: |
108-
mold -run cargo build --all-features
109-
110-
- name: 🧪 Run Rust tests
111-
run: |
112-
mold -run cargo test --all-features
113-
11479
- name: 📃 Generate code documentation info for website
115-
if: github.ref == 'refs/heads/master'
11680
run: |
11781
cd tools/editor-message-tree
11882
cargo run
@@ -121,15 +85,13 @@ jobs:
12185
mv website/generated/hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
12286
12387
- name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
124-
if: github.ref == 'refs/heads/master'
12588
id: cache-website-code-docs
12689
uses: actions/cache/restore@v3
12790
with:
12891
path: artifacts
12992
key: website-code-docs
13093

13194
- name: 🔍 Check if auto-generated code docs artifacts changed
132-
if: github.ref == 'refs/heads/master'
13395
id: website-code-docs-changed
13496
run: |
13597
if ! diff --brief --recursive artifacts-generated artifacts; then
@@ -157,31 +119,3 @@ jobs:
157119
run: |
158120
rm -rf artifacts
159121
gh workflow run website.yml --ref master
160-
161-
# miri:
162-
# runs-on: self-hosted
163-
164-
# steps:
165-
# - uses: actions/checkout@v3
166-
167-
# - name: 🧪 Run Rust miri
168-
# run: |
169-
# mold -run cargo +nightly miri nextest run -j32 --all-features
170-
171-
cargo-deny:
172-
runs-on: ubuntu-latest
173-
174-
steps:
175-
- name: 📥 Clone and checkout repository
176-
uses: actions/checkout@v3
177-
178-
- name: 📜 Check crate license compatibility for root workspace
179-
uses: EmbarkStudios/cargo-deny-action@v2
180-
with:
181-
command: check bans licenses sources
182-
183-
- name: 📜 Check crate license compatibility for /libraries/rawkit
184-
uses: EmbarkStudios/cargo-deny-action@v2
185-
with:
186-
command: check bans licenses sources
187-
manifest-path: libraries/rawkit/Cargo.toml

0 commit comments

Comments
 (0)