BlueGit

ict rusty-teams

Files

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

build.yml

build.yml 6.6 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 Flatpak repackages a tarball built only for it; the release keeps its own tarball.
77 - name: Flatpak
78 continue-on-error: true
79 env:
80 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
81 run: |
82 # 22.04's flatpak-builder 1.2 still calls appstream-compose, which the 26.08 SDK dropped.
83 sudo add-apt-repository -y ppa:flatpak/stable
84 sudo apt-get install --no-install-recommends -y flatpak flatpak-builder
85 DIST="$RUNNER_TEMP/flatpak" packaging/linux/package.sh --skip-build --formats tar
86 packaging/linux/flatpak-bundle.sh --no-test "$RUNNER_TEMP"/flatpak/rusty-teams-*-linux-x86_64.tar.gz
87
88 # The runner is x86_64; the artifact name carries the architecture.
89 - uses: actions/upload-artifact@v7
90 with:
91 name: teams-linux-amd64
92 path: target/release/teams
93
94 - uses: actions/upload-artifact@v7
95 with:
96 name: teams-linux-packages
97 path: dist/release/*
98
99 windows:
100 name: Windows
101 runs-on: windows-latest
102 timeout-minutes: 90
103 defaults:
104 run:
105 shell: bash
106 steps:
107 - uses: actions/checkout@v6
108
109 - uses: dtolnay/rust-toolchain@stable
110
111 - uses: Swatinem/rust-cache@v2
112 with:
113 key: build
114
115 # After the toolchain: staging runs `cargo metadata`.
116 - uses: ./.github/actions/setup-windows
117
118 # fxc.exe comes from the Windows SDK, gpui-pre-windows finds it through the registry.
119 - name: Build
120 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
121
122 # The runner is x86_64; the artifact name carries the architecture.
123 - uses: actions/upload-artifact@v7
124 with:
125 name: teams-windows-amd64
126 path: target/release/teams.exe
127
128 macos:
129 name: macOS
130 runs-on: macos-latest
131 timeout-minutes: 90
132 steps:
133 - uses: actions/checkout@v6
134
135 - uses: dtolnay/rust-toolchain@stable
136
137 - uses: Swatinem/rust-cache@v2
138 with:
139 key: build
140
141 # scripts/build-macos.sh builds the arm64 and x86_64 slices, lipos them into
142 # one universal binary and wraps it in a .app with the icon (README "Quick
143 # start"); it installs the x86_64 rustup target itself and needs Xcode CLT only.
144 - name: Build
145 run: scripts/build-macos.sh crates/app teams
146
147 - uses: actions/upload-artifact@v7
148 with:
149 name: teams-macos
150 path: target/universal/release/teams-macos.zip
151
152 release:
153 name: Release
154 needs: [linux, windows, macos]
155 if: startsWith(github.ref, 'refs/tags/v')
156 runs-on: ubuntu-latest
157 permissions:
158 contents: write
159 steps:
160 - uses: actions/download-artifact@v8
161 with:
162 path: dist
163
164 # Artifacts drop the executable bit, the tarball restores it.
165 - name: Package
166 env:
167 TAG: ${{ github.ref_name }}
168 run: |
169 mkdir release
170 chmod +x dist/teams-linux-amd64/teams
171 tar -czf "release/rusty-teams-$TAG-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
172 # The bare binary is what the Linux self-update downloads (release_feed.rs).
173 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
174 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
175 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
176 # deb, rpm, Flatpak, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
177 # the AppImage's update information looks for that .zsync name.
178 cp dist/teams-linux-packages/* release/
179
180 - uses: softprops/action-gh-release@v3
181 with:
182 files: release/*
183 generate_release_notes: true
184 prerelease: ${{ contains(github.ref_name, '-') }}