Repository navigation
174 lines (168 loc) · 8.1 KB
/
Copy pathopencode-rune-linux-build.yml
File metadata and controls
174 lines (168 loc) · 8.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
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
name: OpenCode (Rune) Linux Build
# Builds the Linux desktop packages (AppImage, deb, rpm) of a branch or commit the way release.yml's
# build-linux does (`cargo build --profile release-quick`, then package-linux.sh), unsigned, and
# keeps them as a workflow artifact for 7 days. It publishes nothing: no environment, no secrets,
# no release, no channel.
#
# - workflow_dispatch: any branch, tag or commit, with or without a pull request (`ref`); x64, and
# arm64 when asked.
# gh workflow run opencode-rune-linux-build.yml -R anomalyco/opencode-rune -f ref=<branch>
# - workflow_call: opencode-rune-pr-build.yml's Linux x64 leg.
#
# The browser engine pin (OPENCODE_BROWSER_ENGINE_TRUST) comes from the live index when it serves
# this commit's engine version; otherwise the build has no pin and its browser reports
# NotPublished, which the job summary says.
on:
workflow_dispatch:
inputs:
ref:
description: Branch, tag or commit to build
required: true
type: string
arm64:
description: Also build linux-arm64
type: boolean
default: false
workflow_call:
inputs:
ref:
required: true
type: string
version:
required: true
type: string
channel:
required: true
type: string
artifact:
description: Artifact name prefix; the arch is appended
required: true
type: string
outputs:
digest:
description: SHA-256 of the x64 artifact's SHA256SUMS
value: ${{ jobs.build.outputs.digest-x64 }}
permissions:
contents: read
defaults:
run:
shell: bash
env:
CARGO_INCREMENTAL: "0"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { arch: x64, host: blacksmith-4vcpu-ubuntu-2404, wanted: true }
- { arch: arm64, host: blacksmith-4vcpu-ubuntu-2404-arm, wanted: "${{ inputs.arm64 == true }}" }
runs-on: ${{ matrix.host }}
timeout-minutes: 120
env:
OPENCODE_RUNE_VERSION: ${{ inputs.version || format('0.0.0-branch-{0}', github.run_number) }}
OPENCODE_RUNE_BUILD_CHANNEL: ${{ inputs.channel || 'branch' }}
ARTIFACT: ${{ inputs.artifact || 'build-opencode-rune-branch-linux' }}-${{ matrix.arch }}
WANTED: ${{ matrix.wanted }}
outputs:
digest-x64: ${{ steps.digest.outputs.digest-x64 }}
steps:
- name: Skip arm64 unless asked
if: env.WANTED != 'true'
run: echo "linux-${{ matrix.arch }} not asked for." >> "$GITHUB_STEP_SUMMARY"
- if: env.WANTED == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- if: env.WANTED == 'true'
name: Install native build and packaging dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang cmake pkg-config nasm libfontconfig1-dev libxkbcommon-dev libwayland-dev libx11-dev libxcb1-dev libdbus-1-dev libudev-dev libssl-dev rpm squashfs-tools
- if: env.WANTED == 'true'
name: Rust toolchain
run: rustup toolchain install
# Reads dev's caches (release.yml saves them); this workflow saves none.
- if: env.WANTED == 'true'
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: linux-${{ matrix.arch }}
save-if: false
- if: env.WANTED == 'true'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/seer/ghostty-vt
key: ghostty-vt-linux-${{ matrix.arch }}-${{ hashFiles('crates/terminal/build.rs', 'crates/terminal/build_support.rs') }}
- if: env.WANTED == 'true'
id: zig
name: Zig version
run: |
version=$(sed -n 's/^pub const ZIG_VERSION: &str = "\(.*\)";$/\1/p' crates/terminal/build_support.rs)
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::Could not read ZIG_VERSION from crates/terminal/build_support.rs." >&2; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
- if: env.WANTED == 'true'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/seer/ghostty-vt/zig-*-${{ steps.zig.outputs.version }}
key: zig-${{ runner.os }}-${{ runner.arch }}-${{ steps.zig.outputs.version }}
- if: env.WANTED == 'true'
id: engine
name: Browser engine pin from the live index
run: |
cef=$(grep -A1 '^name = "cef-dll-sys"$' apps/browser-engine/Cargo.lock |
sed -n 's/^version = "[^"]*+\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)"$/\1/p')
revision=$(sed -n 's/^pub const ENGINE_REVISION: u32 = \([0-9][0-9]*\);$/\1/p' crates/browser-pane/src/installer.rs)
state=$(bash .github/release/opencode-rune-check-engine.sh --plan-state --version "$cef-$revision" --cef-version "$cef")
mode=$(sed -n 's/^mode=//p' <<< "$state")
sha=$(sed -n "s/^linux_${{ matrix.arch }}_sha256=//p" <<< "$state")
cef_sha=$(sed -n "s/^cef_linux_${{ matrix.arch }}_sha256=//p" <<< "$state")
if [[ "$sha" =~ ^[0-9a-f]{64}$ ]] && { [ "$mode" != split ] || [[ "$cef_sha" =~ ^[0-9a-f]{64}$ ]]; }; then
echo "trust=sha256:$sha" >> "$GITHUB_OUTPUT"
if [ "$mode" = split ]; then
echo "cef_trust=sha256:$cef_sha" >> "$GITHUB_OUTPUT"
echo "Browser engine $cef-$revision pinned from the live index (split wrapper + CEF $cef)." >> "$GITHUB_STEP_SUMMARY"
else
echo "cef_trust=" >> "$GITHUB_OUTPUT"
echo "Browser engine $cef-$revision pinned from the live index." >> "$GITHUB_STEP_SUMMARY"
fi
else
echo "::warning::The live index has no linux-${{ matrix.arch }} engine $cef-$revision; this build's browser reports NotPublished."
echo "No live browser engine $cef-$revision for linux-${{ matrix.arch }}: the browser is off in this build." >> "$GITHUB_STEP_SUMMARY"
fi
- if: env.WANTED == 'true'
id: office
name: Office engine pin from the live index
run: |
bo=$(grep -A1 '^name = "betteroffice-opc"$' apps/office-engine/Cargo.lock |
sed -n 's/^version = "\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)"$/\1/p')
rev=$(sed -n 's/^pub const OFFICE_ENGINE_REVISION: u32 = \([0-9][0-9]*\);$/\1/p' features/office/src/engine/installer.rs)
state=$(bash .github/release/opencode-rune-check-office.sh --plan-state --version "$bo-$rev")
sha=$(sed -n "s/^linux_${{ matrix.arch }}_sha256=//p" <<< "$state")
if [[ "$sha" =~ ^[0-9a-f]{64}$ ]]; then
echo "trust=sha256:$sha" >> "$GITHUB_OUTPUT"
echo "Office engine $bo-$rev pinned from the live index." >> "$GITHUB_STEP_SUMMARY"
else
echo "::warning::The live index has no linux-${{ matrix.arch }} office engine $bo-$rev; Office previews report NotPublished in this build."
fi
- if: env.WANTED == 'true'
name: Build and package desktop
env:
OPENCODE_BROWSER_ENGINE_TRUST: ${{ steps.engine.outputs.trust }}
OPENCODE_BROWSER_CEF_TRUST: ${{ steps.engine.outputs.cef_trust }}
OPENCODE_OFFICE_ENGINE_TRUST: ${{ steps.office.outputs.trust }}
run: |
apps/desktop/scripts/set-crate-version.sh "$PWD" "$OPENCODE_RUNE_VERSION"
cargo build --locked -p opencode-desktop --profile release-quick
bash apps/desktop/scripts/package-linux.sh target/release-quick/opencode-desktop "$RUNNER_TEMP/linux"
echo "Built $(git rev-parse --short=9 HEAD) as $OPENCODE_RUNE_VERSION ($OPENCODE_RUNE_BUILD_CHANNEL): artifact \`$ARTIFACT\`." >> "$GITHUB_STEP_SUMMARY"
- if: env.WANTED == 'true'
id: upload
uses: ./.github/release/upload
with:
name: ${{ env.ARTIFACT }}
path: ${{ runner.temp }}/linux
retention-days: "7"
- if: env.WANTED == 'true'
id: digest
run: echo "digest-${{ matrix.arch }}=${{ steps.upload.outputs.digest }}" >> "$GITHUB_OUTPUT"