Skip to content

Commit b0897e3

Browse files
knoppchanderlud
andauthored
feat: updated precompile binaries workflow (#527)
- Updates all Linux workflows to run on Ubuntu 22.04 as 20.04 is being deprecated - Adds docker based compilation to precompile aarch64-unknown-linux-gnu and riscv64gc-unknown-linux-gnu feat: Updated precompile binaries workflow - Updates all Linux workflows to run on Ubuntu 22.04 as 20.04 is being deprecated - Adds docker based compilation to precompile aarch64-unknown-linux-gnu and riscv64gc-unknown-linux-gnu --------- Co-authored-by: chanderlud <me@chanchan.dev>
1 parent 01c04df commit b0897e3

File tree

1 file changed

+78
-4
lines changed

1 file changed

+78
-4
lines changed

.github/workflows/precompile_binaries.yml

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
os:
14-
- ubuntu-20.04
14+
- ubuntu-22.04
1515
- macOS-latest
1616
- windows-latest
1717
steps:
1818
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 #v2.7.0
1919
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d #1.6.0
20+
- uses: mlugg/setup-zig@v1
21+
if: (matrix.os == 'ubuntu-22.04')
22+
with:
23+
version: 0.13.0
2024
- name: Install GTK
21-
if: (matrix.os == 'ubuntu-20.04')
25+
if: (matrix.os == 'ubuntu-22.04')
2226
run: sudo apt-get update && sudo apt-get install libgtk-3-dev
2327
- name: Precompile
2428
if: (matrix.os == 'macOS-latest') || (matrix.os == 'windows-latest')
@@ -28,9 +32,79 @@ jobs:
2832
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
2933
PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }}
3034
- name: Precompile (with Android)
31-
if: (matrix.os == 'ubuntu-20.04')
32-
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=superlistapp/super_native_extensions --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=26.3.11579264 --android-min-sdk-version=23
35+
if: (matrix.os == 'ubuntu-22.04')
36+
run: |
37+
export ZIG_SYSTEM_LIB_DIR="/usr/lib/x86_64-linux-gnu"
38+
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=-L$ZIG_SYSTEM_LIB_DIR"
39+
dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=superlistapp/super_native_extensions --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=26.3.11579264 --android-min-sdk-version=23 --glibc-version=2.31
3340
working-directory: super_native_extensions/cargokit/build_tool
3441
env:
3542
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
3643
PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }}
44+
45+
PrecompileCross:
46+
runs-on: ubuntu-22.04
47+
name: Precompile (${{ matrix.distro }} ${{ matrix.arch }})
48+
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- arch: aarch64
54+
distro: ubuntu22.04
55+
target: aarch64-unknown-linux-gnu
56+
dart_arch: arm64
57+
- arch: riscv64
58+
distro: ubuntu22.04
59+
target: riscv64gc-unknown-linux-gnu
60+
dart_arch: riscv64
61+
62+
steps:
63+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 #v2.7.0
64+
65+
- name: Precompile
66+
uses: uraimo/run-on-arch-action@v3
67+
with:
68+
arch: ${{ matrix.arch }}
69+
distro: ${{ matrix.distro }}
70+
githubToken: ${{ github.token }}
71+
shell: /bin/bash
72+
73+
install: |
74+
case "${{ matrix.distro }}" in
75+
ubuntu*)
76+
apt-get update -q -y
77+
apt-get install -q -y libgtk-3-dev git curl unzip gcc
78+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
79+
curl -o dartsdk-linux-${{ matrix.dart_arch }}-release.zip https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-${{ matrix.dart_arch }}-release.zip
80+
unzip dartsdk-linux-${{ matrix.dart_arch }}-release.zip
81+
mv dart-sdk /usr/lib/dart
82+
curl -o zig.tar.xz https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz
83+
tar -xf zig.tar.xz
84+
mv zig-linux-x86_64-0.14.0 /usr/lib/zig
85+
;;
86+
esac
87+
88+
run: |
89+
export GITHUB_TOKEN=${{ secrets.RELEASE_GITHUB_TOKEN }}
90+
export PRIVATE_KEY=${{ secrets.RELEASE_PRIVATE_KEY }}
91+
export PATH="$PATH:/usr/lib/dart/bin:/usr/lib/zig"
92+
93+
ARCH=$(uname -m)
94+
95+
case "$ARCH" in
96+
"aarch64")
97+
export ZIG_SYSTEM_LIB_DIR="/usr/lib/aarch64-linux-gnu"
98+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=-L$ZIG_SYSTEM_LIB_DIR"
99+
;;
100+
"riscv64")
101+
export ZIG_SYSTEM_LIB_DIR="/usr/lib/riscv64-linux-gnu"
102+
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=-L$ZIG_SYSTEM_LIB_DIR"
103+
;;
104+
*)
105+
echo "Unsupported architecture: $ARCH"
106+
exit 1
107+
;;
108+
esac
109+
110+
cd super_native_extensions/cargokit/build_tool && dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=superlistapp/super_native_extensions --target ${{ matrix.target }} --glibc-version=2.31

0 commit comments

Comments
 (0)