Skip to content

Commit f340dd4

Browse files
alexlapatyranron
andauthored
Pin glibc in Linux artifacts on CI (#191)
Co-authored-by: Kai Ren <[email protected]>
1 parent 380203f commit f340dd4

File tree

1 file changed

+92
-44
lines changed

1 file changed

+92
-44
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
pr:
2424
if: ${{ github.event_name == 'pull_request' }}
2525
needs:
26-
- build
26+
- build-rust
27+
- build-rust-linux
28+
- build-flutter
2729
- clippy
2830
- dartanalyze
2931
- dartfmt
@@ -134,41 +136,22 @@ jobs:
134136
# Building #
135137
############
136138

137-
build:
139+
build-rust:
140+
name: cargo build (${{ matrix.platform }})
138141
strategy:
139142
fail-fast: false
140143
matrix:
141144
platform:
142-
- linux
143145
- macos
144146
- windows
145-
runs-on: ${{ (matrix.platform == 'macos' && 'macos-13')
146-
|| (matrix.platform == 'windows' && 'windows-latest')
147-
|| 'ubuntu-22.04' }}
147+
runs-on: ${{ (matrix.platform == 'macos' && 'macos-13')
148+
|| 'windows-latest' }}
148149
steps:
149150
- uses: actions/checkout@v4
150151
- uses: dtolnay/rust-toolchain@v1
151152
with:
152153
toolchain: stable
153154
- run: make rustup.targets only=${{ matrix.platform }}
154-
- uses: subosito/flutter-action@v2
155-
- run: flutter config --enable-${{ matrix.platform }}-desktop
156-
157-
- name: Install Linux platform dependencies
158-
run: |
159-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc
160-
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo tee /etc/apt/sources.list.d/llvm.list
161-
sudo apt-get update
162-
sudo apt-get install -y \
163-
cmake \
164-
libgtk-3-dev liblzma-dev libpulse-dev libudev-dev \
165-
ninja-build lld-19 binutils build-essential
166-
# TODO: Remove once lld-19 becomes the default in Ubuntu repositories
167-
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-19 100
168-
sudo update-alternatives --config lld
169-
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-19 100
170-
sudo update-alternatives --config ld.lld
171-
if: ${{ matrix.platform == 'linux' }}
172155

173156
# Pin Xcode version for better compatibility.
174157
- uses: maxim-lobanov/setup-xcode@v1
@@ -177,13 +160,82 @@ jobs:
177160
if: ${{ matrix.platform == 'macos' }}
178161

179162
- run: make cargo.build platform=${{ matrix.platform }} debug=no
180-
- run: make flutter.build platform=${{ matrix.platform }}
181163

182164
- uses: actions/upload-artifact@v4
183165
with:
184-
name: build-${{ matrix.platform }}
166+
name: build-rust-${{ matrix.platform }}
167+
path: ${{ matrix.platform }}/rust/
168+
169+
build-rust-linux:
170+
name: cargo build (linux)
171+
runs-on: ubuntu-latest
172+
container: debian:bookworm # pin `glibc` to 2.36 for better compatibility
173+
steps:
174+
- name: Install `linux` platform dependencies
175+
run: |
176+
set -ex
177+
178+
apt-get update
179+
apt-get install -y wget
180+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key \
181+
| tee /etc/apt/trusted.gpg.d/llvm.asc
182+
echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-19 main" \
183+
| tee /etc/apt/sources.list.d/llvm.list
184+
185+
apt-get update
186+
apt-get install -y \
187+
cmake curl \
188+
libgtk-3-dev liblzma-dev libpulse-dev libudev-dev \
189+
libssl-dev ninja-build lld-19 binutils build-essential
190+
update-alternatives --install /usr/bin/lld lld /usr/bin/lld-19 100
191+
update-alternatives --config lld
192+
update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-19 100
193+
update-alternatives --config ld.lld
194+
195+
- uses: actions/checkout@v4
196+
- uses: dtolnay/rust-toolchain@v1
197+
with:
198+
toolchain: stable
199+
- run: make rustup.targets only=linux
200+
201+
- run: make cargo.build platform=linux debug=no
202+
203+
- uses: actions/upload-artifact@v4
204+
with:
205+
name: build-rust-linux
206+
path: linux/rust/
207+
208+
build-flutter:
209+
name: flutter build (${{ matrix.platform }})
210+
needs: ["build-rust", "build-rust-linux"]
211+
strategy:
212+
fail-fast: false
213+
matrix:
214+
platform:
215+
- linux
216+
- macos
217+
- windows
218+
runs-on: ${{ (matrix.platform == 'macos' && 'macos-latest')
219+
|| (matrix.platform == 'windows' && 'windows-latest')
220+
|| 'ubuntu-latest' }}
221+
steps:
222+
- uses: actions/checkout@v4
223+
- uses: subosito/flutter-action@v2
224+
- run: flutter config --enable-${{ matrix.platform }}-desktop
225+
226+
- name: Install `linux` platform dependencies
227+
run: |
228+
sudo apt-get update
229+
sudo apt-get install -y libgtk-3-dev libpulse-dev
230+
if: ${{ matrix.platform == 'linux' }}
231+
232+
- uses: actions/download-artifact@v4
233+
with:
234+
name: build-rust-${{ matrix.platform }}
185235
path: ${{ matrix.platform }}/rust/
186236

237+
- run: make flutter.build platform=${{ matrix.platform }}
238+
187239

188240

189241

@@ -193,7 +245,7 @@ jobs:
193245

194246
test-flutter:
195247
name: test (example, ${{ matrix.platform }})
196-
needs: ["build"]
248+
needs: ["build-rust", "build-rust-linux"]
197249
strategy:
198250
fail-fast: false
199251
matrix:
@@ -227,19 +279,13 @@ jobs:
227279
- name: Install `${{ matrix.platform }}` platform dependencies
228280
run: |
229281
sudo apt-get update
230-
sudo apt-get install -y \
231-
cmake \
232-
libgtk-3-dev liblzma-dev libpulse-dev libudev-dev \
233-
ninja-build \
234-
xvfb lld-19 binutils build-essential
235-
# TODO: Remove once lld-19 becomes the default in Ubuntu repositories
236-
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-19 100
237-
sudo update-alternatives --config lld
238-
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-19 100
239-
sudo update-alternatives --config ld.lld
282+
sudo apt-get install -y libgtk-3-dev libpulse-dev
240283
if: ${{ matrix.platform == 'linux' }}
241284

242-
- run: make cargo.build debug=yes platform=${{ matrix.platform }}
285+
- uses: actions/download-artifact@v4
286+
with:
287+
name: build-rust-${{ matrix.platform }}
288+
path: ${{ matrix.platform }}/rust/
243289
if: ${{ matrix.platform != 'android'
244290
&& matrix.platform != 'ios' }}
245291

@@ -324,9 +370,9 @@ jobs:
324370
- linux
325371
- macos
326372
- windows
327-
runs-on: ${{ (matrix.platform == 'linux' && 'ubuntu-latest')
373+
runs-on: ${{ (matrix.platform == 'macos' && 'macos-latest')
328374
|| (matrix.platform == 'windows' && 'windows-latest')
329-
|| 'macos-latest' }}
375+
|| 'ubuntu-latest' }}
330376
steps:
331377
- uses: actions/checkout@v4
332378
- uses: dtolnay/rust-toolchain@v1
@@ -363,7 +409,9 @@ jobs:
363409
|| (github.event_name == 'pull_request'
364410
&& github.event.pull_request.head.repo.owner.login == 'instrumentisto') }}
365411
needs:
366-
- build
412+
- build-rust
413+
- build-rust-linux
414+
- build-flutter
367415
- clippy
368416
- dartanalyze
369417
- dartfmt
@@ -417,17 +465,17 @@ jobs:
417465

418466
- uses: actions/download-artifact@v4
419467
with:
420-
name: build-linux
468+
name: build-rust-linux
421469
path: linux/rust/
422470
if: ${{ steps.skip.outputs.no == 'true' }}
423471
- uses: actions/download-artifact@v4
424472
with:
425-
name: build-macos
473+
name: build-rust-macos
426474
path: macos/rust/
427475
if: ${{ steps.skip.outputs.no == 'true' }}
428476
- uses: actions/download-artifact@v4
429477
with:
430-
name: build-windows
478+
name: build-rust-windows
431479
path: windows/rust/
432480
if: ${{ steps.skip.outputs.no == 'true' }}
433481

0 commit comments

Comments
 (0)