BlueGit

ict rusty-teams

Files

rusty-teams / .github / workflows / build.yml

build.yml

feat(packaging): Linux AppImage, deb, rpm and Flatpak
metis Samuel David Merlin Kemper · pushed by metis · 2 weeks ago
228f36c5 History
build.yml 5.9 KiB Download Raw
1# Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
2# binary from scripts/build-macos.sh and the Linux packages from
3# packaging/linux/package.sh. Tests live in test.yml; this file only packages the
4# artifacts.
5name: Build
6
7# Builds run for tags (the release assets); pushes are tested in test.yml.
8# A `v*` tag also publishes a GitHub release; a tag with `-` (v0.2.0-rc.1) is a pre-release.
9on:
10 push:
11 tags: ['*']
12 workflow_dispatch:
13
14permissions:
15 contents: read
16
17concurrency:
18 group: ${{ github.workflow }}-${{ github.ref }}
19 cancel-in-progress: true
20
21env:
22 CARGO_TERM_COLOR: always
23
24jobs:
25 linux:
26 name: Linux
27 # The oldest supported Ubuntu LTS: the binary needs the glibc it was built
28 # against, so building here lets it, the AppImage and the deb/rpm run on
29 # glibc 2.35 and newer.
30 runs-on: ubuntu-22.04
31 timeout-minutes: 90
32 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
33 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
34 # check_clang_version in vendor/webrtc-sys/build.rs). The distro clang is older
35 # (18 on ubuntu-24.04), so setup-linux installs clang 21 and these point every
36 # compile and the final link at it.
37 env:
38 CC: clang-21
39 CXX: clang++-21
40 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang-21
41 steps:
42 - uses: actions/checkout@v6
43
44 - uses: ./.github/actions/setup-linux
45
46 - uses: dtolnay/rust-toolchain@stable
47
48 # Its own key: build scripts cached on a newer Ubuntu would need a newer glibc.
49 - uses: Swatinem/rust-cache@v2
50 with:
51 key: build-ubuntu-22.04
52
53 - name: Build
54 run: cargo build -p app --release
55
56 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
57 # and appstream validate the metadata. AppImage tooling is downloaded by
58 # package.sh at pinned digests.
59 - name: Install packaging tools
60 env:
61 NFPM_VERSION: 2.48.0
62 NFPM_SHA256: 787af76e172dd5fc7cedf4d7c5a090a2f62be9001557a4db1103e270f90ddefd
63 run: |
64 sudo apt-get install --no-install-recommends -y zsync desktop-file-utils appstream
65 curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \
66 "https://github.com/goreleaser/nfpm/releases/download/v$NFPM_VERSION/nfpm_${NFPM_VERSION}_amd64.deb"
67 echo "$NFPM_SHA256 $RUNNER_TEMP/nfpm.deb" | sha256sum -c -
68 sudo dpkg -i "$RUNNER_TEMP/nfpm.deb"
69
70 # A tag build carries the tag's version (v0.5.0-rc.1 -> 0.5.0~rc.1 in the deb).
71 - name: Package
72 env:
73 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
74 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
75
76 # The runner is x86_64; the artifact name carries the architecture.
77 - uses: actions/upload-artifact@v7
78 with:
79 name: teams-linux-amd64
80 path: target/release/teams
81
82 - uses: actions/upload-artifact@v7
83 with:
84 name: teams-linux-packages
85 path: dist/release/*
86
87 windows:
88 name: Windows
89 runs-on: windows-latest
90 timeout-minutes: 90
91 defaults:
92 run:
93 shell: bash
94 steps:
95 - uses: actions/checkout@v6
96
97 - uses: dtolnay/rust-toolchain@stable
98
99 - uses: Swatinem/rust-cache@v2
100 with:
101 key: build
102
103 # After the toolchain: staging runs `cargo metadata`.
104 - uses: ./.github/actions/setup-windows
105
106 # fxc.exe comes from the Windows SDK, gpui-pre-windows finds it through the registry.
107 - name: Build
108 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
109
110 # The runner is x86_64; the artifact name carries the architecture.
111 - uses: actions/upload-artifact@v7
112 with:
113 name: teams-windows-amd64
114 path: target/release/teams.exe
115
116 macos:
117 name: macOS
118 runs-on: macos-latest
119 timeout-minutes: 90
120 steps:
121 - uses: actions/checkout@v6
122
123 - uses: dtolnay/rust-toolchain@stable
124
125 - uses: Swatinem/rust-cache@v2
126 with:
127 key: build
128
129 # scripts/build-macos.sh builds the arm64 and x86_64 slices, lipos them into
130 # one universal binary and wraps it in a .app with the icon (README "Quick
131 # start"); it installs the x86_64 rustup target itself and needs Xcode CLT only.
132 - name: Build
133 run: scripts/build-macos.sh crates/app teams
134
135 - uses: actions/upload-artifact@v7
136 with:
137 name: teams-macos
138 path: target/universal/release/teams-macos.zip
139
140 release:
141 name: Release
142 needs: [linux, windows, macos]
143 if: startsWith(github.ref, 'refs/tags/v')
144 runs-on: ubuntu-latest
145 permissions:
146 contents: write
147 steps:
148 - uses: actions/download-artifact@v8
149 with:
150 path: dist
151
152 # Artifacts drop the executable bit, the tarball restores it.
153 - name: Package
154 env:
155 TAG: ${{ github.ref_name }}
156 run: |
157 mkdir release
158 chmod +x dist/teams-linux-amd64/teams
159 tar -czf "release/rusty-teams-$TAG-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
160 # The bare binary is what the Linux self-update downloads (release_feed.rs).
161 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
162 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
163 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
164 # deb, rpm, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
165 # the AppImage's update information looks for that .zsync name.
166 cp dist/teams-linux-packages/* release/
167
168 - uses: softprops/action-gh-release@v3
169 with:
170 files: release/*
171 generate_release_notes: true
172 prerelease: ${{ contains(github.ref_name, '-') }}