Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AOT build for android-riscv64 #2399

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 0 additions & 80 deletions .github/workflows/build-android.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .github/workflows/build-linux-musl.yml

This file was deleted.

103 changes: 69 additions & 34 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,129 @@ jobs:
build:
name: Build

runs-on: ${{ matrix.runner }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: ubuntu-latest
- image: docker.io/library/dart
platform: linux/amd64
- arch: ia32
runner: ubuntu-latest
target: linux-x64
- image: docker.io/library/dart
platform: linux/amd64
- arch: arm64
runner: linux-arm64
target: linux-ia32
- image: docker.io/library/dart
platform: linux/arm64
- arch: arm
runner: linux-arm64
target: linux-arm64
- image: docker.io/library/dart
platform: linux/arm/v7
- arch: riscv64
runner: ubuntu-latest
target: linux-arm
- image: docker.io/library/debian:unstable-slim
platform: linux/riscv64
target: linux-riscv64
- image: ghcr.io/dart-musl/dart
platform: linux/amd64
target: linux-x64-musl
- image: ghcr.io/dart-musl/dart
platform: linux/amd64
target: linux-ia32-musl
- image: ghcr.io/dart-musl/dart
platform: linux/arm64
target: linux-arm64-musl
- image: ghcr.io/dart-musl/dart
platform: linux/arm/v7
target: linux-arm-musl
- image: ghcr.io/dart-musl/dart
platform: linux/riscv64
target: linux-riscv64-musl
- image: ghcr.io/dart-android/dart
platform: linux/amd64
target: android-x64
- image: ghcr.io/dart-android/dart
platform: linux/amd64
target: android-ia32
- image: ghcr.io/dart-android/dart
platform: linux/arm64
target: android-arm64
- image: ghcr.io/dart-android/dart
platform: linux/arm64
target: android-arm
- image: ghcr.io/dart-android/dart
platform: linux/riscv64
target: android-riscv64

steps:
- uses: actions/checkout@v4

- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:master
run: docker run --privileged --rm registry.fedoraproject.org/fedora-minimal /bin/sh -c "microdnf install --assumeyes --nodocs --setopt=install_weak_deps=False qemu-user-static systemd-udev && mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc && /usr/lib/systemd/systemd-binfmt --unregister && /usr/lib/systemd/systemd-binfmt"

- name: Compile Protobuf
- name: Build
if: matrix.image != 'ghcr.io/dart-android/dart' && matrix.image != 'docker.io/library/debian:unstable-slim'
run: |
docker run --rm -i \
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
docker.io/library/dart <<'EOF'
${{ matrix.image }} <<'EOF'
set -e
curl -fsSL -H "Authorization: Bearer ${{ github.token }}" "https://github.com/bufbuild/buf/releases/latest/download/buf-$(uname -s)-$(uname -m).tar.gz" | tar -xzC /usr/local --strip-components 1
dart pub get
dart run grinder protobuf
dart run grinder pkg-standalone-${{ matrix.target }}
EOF

- name: Build
if: matrix.arch != 'riscv64'
if: matrix.image == 'ghcr.io/dart-android/dart'
run: |
docker run --rm -i \
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
docker.io/library/dart:latest <<'EOF'
--privileged \
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
${{ matrix.image }} <<'EOF'
set -e
export DART_SDK=/system/${{ endsWith(matrix.target, '64') && 'lib64' || 'lib' }}/dart
export PATH=$DART_SDK/bin:$PATH
dart pub get
dart run grinder pkg-standalone-linux-${{ matrix.arch }}
dart run grinder pkg-standalone-${{ matrix.target }}
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'
- name: Build
if: matrix.image == 'docker.io/library/debian:unstable-slim'
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
curl -fsSLO "https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_VERSION/sdk/dartsdk-${{ matrix.target }}-release.zip"

docker run --rm -i \
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
docker.io/library/debian:unstable-slim <<'EOF'
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
${{ matrix.image }} <<'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"
SDK="dartsdk-${{ matrix.target }}-release.zip"
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK"

dart pub get
dart run grinder pkg-standalone-linux-${{ matrix.arch }}
dart run grinder pkg-standalone-${{ matrix.target }}
EOF

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-linux-${{ matrix.arch }}
name: build-${{ matrix.target }}
path: build/*.tar.gz
if-no-files-found: error
compression-level: 0
10 changes: 1 addition & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@ on:
workflow_call:

jobs:
build_android:
uses: ./.github/workflows/build-android.yml
secrets: inherit

build_linux:
uses: ./.github/workflows/build-linux.yml
secrets: inherit

build_linux_musl:
uses: ./.github/workflows/build-linux-musl.yml
secrets: inherit

build_macos:
uses: ./.github/workflows/build-macos.yml
secrets: inherit
Expand All @@ -27,7 +19,7 @@ jobs:
release_github:
name: Release Github
runs-on: ubuntu-latest
needs: [build_android, build_linux, build_linux_musl, build_macos, build_windows]
needs: [build_linux, build_macos, build_windows]

steps:
- uses: actions/checkout@v4
Expand Down