Skip to content

Commit a1b372e

Browse files
authored
Enable AOT build for linux-riscv64 (#2260)
1 parent ecff05d commit a1b372e

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/build-linux.yml

+31-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ jobs:
2222
platform: linux/arm/v7
2323
- arch: arm64
2424
platform: linux/arm64
25-
# There is no docker image for riscv64 dart-sdk, build kernel snapshot instead.
26-
# https://github.com/dart-lang/dart-docker/issues/96#issuecomment-1669860829
2725
- arch: riscv64
28-
platform: linux/amd64 # linux/riscv64
26+
platform: linux/riscv64
2927

3028
steps:
3129
- uses: actions/checkout@v4
@@ -46,6 +44,7 @@ jobs:
4644
EOF
4745
4846
- name: Build
47+
if: matrix.arch != 'riscv64'
4948
run: |
5049
docker run --rm -i \
5150
--platform ${{ matrix.platform }} \
@@ -57,6 +56,35 @@ jobs:
5756
dart run grinder pkg-standalone-linux-${{ matrix.arch }}
5857
EOF
5958
59+
# https://github.com/dart-lang/dart-docker/issues/96#issuecomment-1669860829
60+
# There is no official riscv64 dart container image yet, build on debian:unstable instead.
61+
# The setup is adopted from: https://github.com/dart-lang/dart-docker/blob/main/Dockerfile-debian.template
62+
- name: Build riscv64
63+
if: matrix.arch == 'riscv64'
64+
run: |
65+
DART_CHANNEL=stable
66+
DART_VERSION=$(curl -fsSL https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/latest/VERSION | yq .version)
67+
curl -fsSLO https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_VERSION/sdk/dartsdk-linux-${{ matrix.arch }}-release.zip
68+
69+
docker run --rm -i \
70+
--platform ${{ matrix.platform }} \
71+
--volume "$PWD:$PWD" \
72+
--workdir "$PWD" \
73+
docker.io/library/debian:unstable-slim <<'EOF'
74+
set -e
75+
apt-get update
76+
apt-get install -y --no-install-recommends ca-certificates curl dnsutils git openssh-client unzip
77+
78+
export DART_SDK=/usr/lib/dart
79+
export PATH=$DART_SDK/bin:/root/.pub-cache/bin:$PATH
80+
81+
SDK="dartsdk-linux-${{ matrix.arch }}-release.zip"
82+
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK"
83+
84+
dart pub get
85+
dart run grinder pkg-standalone-linux-${{ matrix.arch }}
86+
EOF
87+
6088
- name: Upload Artifact
6189
uses: actions/upload-artifact@v4
6290
with:

0 commit comments

Comments
 (0)