Repository navigation
239 lines (218 loc) · 9.69 KB
/
Copy pathdev.yml
File metadata and controls
239 lines (218 loc) · 9.69 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: dev
# Continuous-integration workflow that runs on every push to `dev` and on
# pull requests. Runs the workspace test suite (see the `test` job) and, in
# parallel, compiles the `CrabPort` binary for all six platform × arch
# combinations, uploading each artifact to the workflow run so it can be
# downloaded for smoke testing without cutting a release.
#
# Packaging strategy:
# - macOS → `cargo bundle --format dmg` → `.dmg` disk image
# - Linux → `cargo bundle --format appimage` → `.AppImage`
# - Windows → `cargo build` + `Compress-Archive` → `.zip`
# (cargo-bundle's MSI support has a bug in v0.11.0 where it inserts a
# string value into a binary column, so we ship a zipped .exe instead.)
#
# Bundling (vs. shipping raw binaries) gives users a self-contained
# installable package on every platform. On Linux in particular this
# matters: an AppImage bundles the X11/Wayland/Vulkan/font/etc. runtime
# libs so users don't have to install ~15 -dev packages by hand.
on:
push:
branches: [dev]
pull_request:
branches: [dev]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Pin the toolchain so CI failures don't silently come from a rolling
# rustup. Bump deliberately when upgrading the project's MSRV.
RUST_TOOLCHAIN: 1.91.1
jobs:
# Runs the whole workspace test suite (store/SQLite, proxy loopback
# handshakes, telnet IAC, ssh known_hosts/monitor parsing, sftp archive,
# ui pure helpers). A single Linux runner is enough — the tests are
# platform-independent — and it runs in parallel with the build matrix so
# packaging isn't delayed; a red test still fails the workflow (and the
# README badge).
test:
name: Test (linux-x86_64)
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
# Compiling crabport-ui's tests links gpui, which needs the same
# native X11/Wayland/Vulkan/font/audio dev packages as the build job.
- name: Install Linux system dependencies
run: |
sudo add-apt-repository -y universe || true
sudo apt-get update
sudo apt-get install -y \
libx11-dev libx11-xcb-dev libxcb1-dev libxcb-randr0-dev \
libxcb-keysyms1-dev libxcb-icccm4-dev libxcb-image0-dev \
libxcb-shape0-dev libxcb-xfixes0-dev libxcb-cursor-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev wayland-protocols \
libgl1-mesa-dev libegl1-mesa-dev libvulkan-dev \
libfontconfig1-dev libfreetype6-dev \
libasound2-dev libpulse-dev libdbus-1-dev \
libssl-dev pkg-config
# Separate cache key from the build job: tests compile the debug
# profile, so sharing a key would just thrash the release cache.
- name: Cache cargo registry + target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-x86_64-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-cargo-test-
- name: Run tests
run: cargo test --workspace
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# macOS — both arches run on Apple Silicon runners. The legacy
# Intel `macos-13` pool queues for ages / times out, and `macos-14`
# has been retired (its label no longer resolves: "configuration
# 'macos-14-arm64-us-default' is not supported"). `macos-15`
# cross-compiles x86_64 via `--target x86_64-apple-darwin` with no
# extra setup (Apple's toolchain supports it out of the box).
# `dmg` format uses hdiutil (macOS built-in).
- os: macos
arch: x86_64
target: x86_64-apple-darwin
runner: macos-15
bundle_format: dmg
artifact_ext: dmg
- os: macos
arch: aarch64
target: aarch64-apple-darwin
runner: macos-15
bundle_format: dmg
artifact_ext: dmg
# Linux — x64 runs on a standard Ubuntu runner; aarch64 runs on
# GitHub's native ARM Ubuntu runner so we avoid cross-compiling
# gpui's native (X11/Wayland/Vulkan/font) dependencies.
- os: linux
arch: x86_64
target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
bundle_format: appimage
artifact_ext: AppImage
- os: linux
arch: aarch64
target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
bundle_format: appimage
artifact_ext: AppImage
# Windows — both arches run on the windows runner; aarch64
# cross-compiles via the MSVC arm64 toolchain (shipped with the
# image, no extra setup needed beyond the rust target).
# We ship a zipped .exe because cargo-bundle's MSI bundler has a
# bug (see comment at top of file).
- os: windows
arch: x86_64
target: x86_64-pc-windows-msvc
runner: windows-2022
artifact_ext: zip
- os: windows
arch: aarch64
target: aarch64-pc-windows-msvc
runner: windows-2022
artifact_ext: zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
targets: ${{ matrix.target }}
- name: Install cargo-bundle
if: runner.os != 'Windows'
run: cargo install cargo-bundle --locked
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
# Enable universe (libxcb-cursor-dev lives there) — GitHub's
# ubuntu runners enable it by default, but be explicit so a future
# image change can't silently break us.
sudo add-apt-repository -y universe || true
sudo apt-get update
# gpui on Linux links against X11 / Wayland / Vulkan / fontconfig
# / freetype / alsa / pulseaudio / dbus / openssl at build time.
# No `squashfs-tools` needed: cargo-bundle 0.12+ assembles the
# AppImage SquashFS payload in pure Rust.
sudo apt-get install -y \
libx11-dev libx11-xcb-dev libxcb1-dev libxcb-randr0-dev \
libxcb-keysyms1-dev libxcb-icccm4-dev libxcb-image0-dev \
libxcb-shape0-dev libxcb-xfixes0-dev libxcb-cursor-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev wayland-protocols \
libgl1-mesa-dev libegl1-mesa-dev libvulkan-dev \
libfontconfig1-dev libfreetype6-dev \
libasound2-dev libpulse-dev libdbus-1-dev \
libssl-dev pkg-config
- name: Cache cargo registry + target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-cargo-
# ---- Build --------------------------------------------------------
- name: Build bundle (non-Windows)
if: runner.os != 'Windows'
run: cargo bundle --release --target ${{ matrix.target }} --format ${{ matrix.bundle_format }}
# No Linux post-processing is needed with cargo-bundle 0.12+: it writes
# both the root-level `<bin>.png` and `.DirIcon` into the AppDir from the
# PNG/ICNS icon list on its own. (0.11.0's `generate_dir_icon` only
# handled SVG icons, which is why this workflow used to rebuild the
# squashfs + runtime by hand to inject them.)
- name: Build and package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cargo build --release --target ${{ matrix.target }}
$exePath = "target\${{ matrix.target }}\release\CrabPort.exe"
$ref = "${{ github.ref_name }}" -replace '/', '-'
$sha = "${{ github.sha }}".Substring(0, 7)
$name = "CrabPort-$ref-$sha-windows-${{ matrix.arch }}.zip"
Compress-Archive -Path $exePath -DestinationPath "$env:RUNNER_TEMP\$name"
"artifact=$env:RUNNER_TEMP\$name" >> $env:GITHUB_ENV
# ---- Stage artifacts to a predictable path ------------------------
# The bundle lands under target/<triple>/release/bundle/<format>/.
# We locate the produced artifact and copy it to a predictable name
# so the upload step has a single path to reference.
- name: Stage artifact (non-Windows)
if: runner.os != 'Windows'
run: |
set -e
bundle_dir="target/${{ matrix.target }}/release/bundle/${{ matrix.bundle_format }}"
ref="${GITHUB_REF_NAME//\//-}"
sha="${GITHUB_SHA::7}"
name="CrabPort-${ref}-${sha}-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.artifact_ext }}"
artifact_path="$(find "$bundle_dir" -maxdepth 2 -type f -name '*.${{ matrix.artifact_ext }}' | head -n1)"
cp "$artifact_path" "$RUNNER_TEMP/$name"
echo "artifact=$RUNNER_TEMP/$name" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: CrabPort-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ env.artifact }}
if-no-files-found: error
retention-days: 14