From a1b372eaf1188e34e1bda2628db45ca17fd621c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Tue, 11 Jun 2024 16:39:13 -0700 Subject: [PATCH] Enable AOT build for linux-riscv64 (#2260) --- .github/workflows/build-linux.yml | 34 ++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index c8f5ddd41..308c5ec58 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -22,10 +22,8 @@ jobs: platform: linux/arm/v7 - arch: arm64 platform: linux/arm64 - # There is no docker image for riscv64 dart-sdk, build kernel snapshot instead. - # https://github.com/dart-lang/dart-docker/issues/96#issuecomment-1669860829 - arch: riscv64 - platform: linux/amd64 # linux/riscv64 + platform: linux/riscv64 steps: - uses: actions/checkout@v4 @@ -46,6 +44,7 @@ jobs: EOF - name: Build + if: matrix.arch != 'riscv64' run: | docker run --rm -i \ --platform ${{ matrix.platform }} \ @@ -57,6 +56,35 @@ jobs: dart run grinder pkg-standalone-linux-${{ matrix.arch }} EOF + # https://github.com/dart-lang/dart-docker/issues/96#issuecomment-1669860829 + # There is no official riscv64 dart container image yet, build on debian:unstable instead. + # The setup is adopted from: https://github.com/dart-lang/dart-docker/blob/main/Dockerfile-debian.template + - name: Build riscv64 + if: matrix.arch == 'riscv64' + run: | + DART_CHANNEL=stable + DART_VERSION=$(curl -fsSL https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/latest/VERSION | yq .version) + curl -fsSLO https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_VERSION/sdk/dartsdk-linux-${{ matrix.arch }}-release.zip + + docker run --rm -i \ + --platform ${{ matrix.platform }} \ + --volume "$PWD:$PWD" \ + --workdir "$PWD" \ + docker.io/library/debian:unstable-slim <<'EOF' + set -e + apt-get update + apt-get install -y --no-install-recommends ca-certificates curl dnsutils git openssh-client unzip + + export DART_SDK=/usr/lib/dart + export PATH=$DART_SDK/bin:/root/.pub-cache/bin:$PATH + + SDK="dartsdk-linux-${{ matrix.arch }}-release.zip" + unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" + + dart pub get + dart run grinder pkg-standalone-linux-${{ matrix.arch }} + EOF + - name: Upload Artifact uses: actions/upload-artifact@v4 with: