-
Notifications
You must be signed in to change notification settings - Fork 357
136 lines (121 loc) · 5.01 KB
/
build-linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build for linux
on:
workflow_call:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: docker.io/library/dart
platform: linux/amd64
target: linux-x64
- image: docker.io/library/dart
platform: linux/amd64
target: linux-ia32
- image: docker.io/library/dart
platform: linux/arm64
target: linux-arm64
- image: docker.io/library/dart
platform: linux/arm/v7
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
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: 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" \
${{ matrix.image }} <<'EOF'
set -e
dart pub get
dart run grinder pkg-standalone-${{ matrix.target }}
EOF
- name: Build
if: matrix.image == 'ghcr.io/dart-android/dart'
run: |
docker run --rm -i \
--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-${{ 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
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-${{ matrix.target }}-release.zip"
docker run --rm -i \
--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-${{ matrix.target }}-release.zip"
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK"
dart pub get
dart run grinder pkg-standalone-${{ matrix.target }}
EOF
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.target }}
path: build/*.tar.gz
if-no-files-found: error
compression-level: 0