Repository navigation
86 lines (80 loc) · 3.43 KB
/
Copy pathopencode-rune-web.yml
File metadata and controls
86 lines (80 loc) · 3.43 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
name: OpenCode (Rune) Web Build
# Builds the browser build (apps/web: the desktop app as wasm with WebGPU) and uploads the
# static folder as an artifact, to keep dev's web build honest and to give a bundle to try. It
# deploys nothing: serve the folder locally (`pwsh scripts/web.ps1 -NoBuild`, or any static
# server) and open it in Chrome or Edge.
#
# Three times a day, and only when dev moved since the last green run; or by hand. Not on every
# push: dev moves dozens of times a day, and every push's own wasm32 check runs before it.
on:
schedule:
- cron: "17 3,11,19 * * *"
workflow_dispatch:
permissions:
contents: read
actions: read
concurrency:
group: opencode-rune-web
cancel-in-progress: true
jobs:
# Dev only: a dispatch from another branch builds nothing (web needs this job).
moved:
if: github.ref == 'refs/heads/dev'
runs-on: blacksmith-2vcpu-ubuntu-2404
outputs:
build: ${{ steps.check.outputs.build }}
steps:
- id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
last=$(gh run list -R "$GITHUB_REPOSITORY" --workflow opencode-rune-web.yml --branch dev --status success --limit 1 --json headSha -q '.[0].headSha' || true)
if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ] || [ "$last" != "$GITHUB_SHA" ]; then
echo "build=true" >> "$GITHUB_OUTPUT"
else
echo "dev hasn't moved since the last green run ($last)"
echo "build=false" >> "$GITHUB_OUTPUT"
fi
web:
needs: moved
if: needs.moved.outputs.build == 'true'
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# rust-toolchain.toml picks the toolchain.
- name: Rust toolchain
run: |
rustup toolchain install
rustup target add wasm32-unknown-unknown
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: web-wasm32
save-if: ${{ github.ref == 'refs/heads/dev' }}
- name: wasm-bindgen version
id: bindgen
run: echo "version=$(grep -A1 '^name = "wasm-bindgen"$' Cargo.lock | sed -n 's/^version = "\(.*\)"/\1/p')" >> "$GITHUB_OUTPUT"
- id: bindgen-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cargo/bin/wasm-bindgen
key: wasm-bindgen-cli-${{ steps.bindgen.outputs.version }}-linux
- name: wasm-bindgen
if: steps.bindgen-cache.outputs.cache-hit != 'true'
run: cargo install wasm-bindgen-cli --version "${{ steps.bindgen.outputs.version }}" --locked
# The terminal's libghostty-vt for wasm32, and the Zig that builds it (crates/terminal/build.rs),
# outside target/: about 2.5 minutes when it isn't cached.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/seer/ghostty-vt
key: ghostty-vt-wasm32-${{ hashFiles('crates/terminal/build.rs', 'crates/terminal/build_support.rs') }}
- name: Build
shell: pwsh
run: scripts/web.ps1 -NoServe -Out "$env:RUNNER_TEMP/web"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: opencode-rune-web-${{ github.sha }}
path: ${{ runner.temp }}/web
retention-days: 14