Skip to content

Commit 1fffea5

Browse files
committed
Initial commit
0 parents  commit 1fffea5

File tree

7 files changed

+506
-0
lines changed

7 files changed

+506
-0
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/build.yml

+257
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
name: build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: Dart SDK git ref
8+
required: true
9+
type: string
10+
workflow_dispatch:
11+
inputs:
12+
ref:
13+
description: Dart SDK git ref
14+
required: true
15+
type: string
16+
default: main
17+
18+
jobs:
19+
archive:
20+
runs-on: ubuntu-latest
21+
22+
container:
23+
image: docker.io/library/debian
24+
25+
outputs:
26+
checked-in-sdk-version: ${{ steps.fetch.outputs.version }}
27+
28+
steps:
29+
- name: Install build tools
30+
run: |
31+
apt-get update
32+
apt-get install --no-install-recommends -y ca-certificates curl git python3
33+
34+
- name: Fetch Dart SDK
35+
id: fetch
36+
run: |
37+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
38+
export DEPOT_TOOLS_UPDATE=0 PATH=$PWD/depot_tools:$PATH
39+
40+
mkdir dart-sdk
41+
cd dart-sdk
42+
gclient config --name sdk https://dart.googlesource.com/sdk.git@${{ inputs.ref }}
43+
gclient sync --no-history --nohooks
44+
python3 sdk/tools/generate_package_config.py
45+
python3 sdk/tools/generate_sdk_version_file.py
46+
47+
cd sdk
48+
gclient getdep --var sdk_tag | tr : = | tee -a $GITHUB_OUTPUT
49+
50+
- name: Patch Dart SDK 2.19
51+
if: startsWith(inputs.ref, '2.19.')
52+
run: |
53+
cd dart-sdk/sdk
54+
xargs -n 1 -- sh -xc 'curl -fsSL "https://github.com/dart-lang/sdk/commit/$1.diff" | git apply -' -- <<'EOF'
55+
afe921902609e95e5050dad1fe82d2a69bcdcf95
56+
4486a3f45dc40aa8ab1357db38da465c5899631f
57+
EOF
58+
59+
- name: Remove build tools
60+
run: |
61+
cd dart-sdk/sdk
62+
rm -rf buildtools
63+
mkdir -p buildtools/ninja
64+
ln -s /usr/bin/gn buildtools/gn
65+
ln -s /usr/bin/ninja buildtools/ninja/ninja
66+
67+
- name: Remove Checked-in SDK
68+
run: |
69+
cd dart-sdk/sdk
70+
rm -rf tools/sdks/dart-sdk
71+
72+
- name: Archive
73+
run: |
74+
python3 dart-sdk/sdk/tools/linux_dist_support/create_tarball.py --tar_filename dart-${{ inputs.ref }}.tar.gz
75+
76+
- name: Upload Artifact
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: dart-${{ inputs.ref }}
80+
path: dart-${{ inputs.ref }}.tar.gz
81+
if-no-files-found: error
82+
83+
bootstrap:
84+
needs: [archive]
85+
86+
runs-on: ubuntu-latest
87+
88+
container:
89+
image: docker.io/library/debian
90+
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
include:
95+
- host-arch: x64
96+
target-arch: x64
97+
98+
steps:
99+
- name: Install build tools
100+
run: |
101+
apt-get update
102+
apt-get install --no-install-recommends -y ca-certificates curl git python3 xz-utils
103+
104+
- name: Download Dart SDK
105+
id: download
106+
run: |
107+
if curl -fsSLO ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ needs.archive.outputs.checked-in-sdk-version }}/dartsdk-linux-${{ matrix.target-arch }}-release.tar.gz; then
108+
echo "cache-hit=true" | tee -a $GITHUB_OUTPUT
109+
else
110+
echo "cache-hit=false" | tee -a $GITHUB_OUTPUT
111+
fi
112+
113+
- name: Fetch Dart SDK
114+
if: steps.download.outputs.cache-hit != 'true'
115+
run: |
116+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
117+
export DEPOT_TOOLS_UPDATE=0 PATH=$PWD/depot_tools:$PATH
118+
119+
mkdir dart-sdk
120+
cd dart-sdk
121+
gclient config --name sdk https://dart.googlesource.com/sdk.git@${{ needs.archive.outputs.checked-in-sdk-version }}
122+
gclient sync --no-history
123+
124+
- name: Build
125+
if: steps.download.outputs.cache-hit != 'true'
126+
run: |
127+
cd dart-sdk/sdk
128+
./tools/build.py --no-goma --mode release --arch ${{ matrix.target-arch }} --gn-args 'dart_use_tcmalloc=false' create_sdk
129+
130+
- name: Archive
131+
if: steps.download.outputs.cache-hit != 'true'
132+
run: |
133+
tar -czf dartsdk-linux-${{ matrix.target-arch }}-release.tar.gz -C dart-sdk/sdk/out/Release* -- dart-sdk
134+
135+
- name: Upload Artifact
136+
uses: actions/upload-artifact@v3
137+
with:
138+
name: dartsdk-linux-${{ matrix.target-arch }}-${{ needs.archive.outputs.checked-in-sdk-version }}@bootstrap-${{ inputs.ref }}
139+
path: dartsdk-linux-${{ matrix.target-arch }}-release.tar.gz
140+
if-no-files-found: error
141+
142+
build:
143+
needs: [bootstrap, archive]
144+
145+
runs-on: ubuntu-latest
146+
147+
container:
148+
image: docker.io/library/alpine
149+
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
include:
154+
- host-arch: x64
155+
target-arch: x64
156+
- host-arch: x64
157+
target-arch: ia32
158+
- host-arch: x64
159+
target-arch: arm64
160+
- host-arch: x64
161+
target-arch: arm
162+
163+
steps:
164+
- name: Download Artifact
165+
uses: actions/download-artifact@v3
166+
with:
167+
name: dart-${{ inputs.ref }}
168+
169+
- name: Download Artifact
170+
uses: actions/download-artifact@v3
171+
with:
172+
name: dartsdk-linux-${{ matrix.host-arch }}-${{ needs.archive.outputs.checked-in-sdk-version }}@bootstrap-${{ inputs.ref }}
173+
174+
- name: Unarchive
175+
run: |
176+
mkdir dart-sdk
177+
cd dart-sdk
178+
tar -xzf ../dart-${{ inputs.ref }}.tar.gz --strip-components=1
179+
mv dart sdk
180+
tar -xzf ../dartsdk-linux-${{ matrix.host-arch }}-release.tar.gz -C sdk/tools/sdks
181+
rm -f ../*.tar.gz
182+
183+
- name: Verify Checked-in Dart SDK
184+
run: |
185+
cd dart-sdk/sdk
186+
if ! ./tools/sdks/dart-sdk/bin/dart --version; then
187+
apk add --no-cache gcompat
188+
./tools/sdks/dart-sdk/bin/dart --version
189+
fi
190+
191+
- name: Install build tools
192+
run: |
193+
apk add --no-cache alpine-sdk bash clang curl gn lld llvm python3
194+
195+
- name: Install sysroot
196+
run: |
197+
cd dart-sdk/sdk
198+
./build/linux/alpine_sysroot_scripts/install-sysroot.sh
199+
200+
- name: Setup multiarch musl
201+
run: |
202+
cd dart-sdk/sdk
203+
find build/linux -mindepth 1 -maxdepth 1 -name 'alpine-*-sysroot' -print0 | xargs -0 -n 1 -I {} -- find {}/lib -mindepth 1 -maxdepth 1 \( -name 'ld-musl-*.so.1' -o -name 'libc.musl-*.so.1' \) -print0 | xargs -0 -n 1 -- sh -xc 'cp -u "$1" /lib' --
204+
205+
- name: Configure tcmalloc
206+
run: |
207+
apk add --no-cache autoconf automake libtool
208+
cd dart-sdk/sdk/third_party/tcmalloc/gperftools
209+
./autogen.sh
210+
./configure --enable-emergency-malloc --enable-frame-pointers --enable-cpu-profiler --disable-heap-checker --disable-debugalloc --enable-sized-delete --disable-libunwind
211+
cd ../include
212+
find . -type f -print0 | xargs -0 -n 1 -- sh -xc 'cp -f "../gperftools/src/$1" "$1"' --
213+
214+
- name: Build
215+
run: |
216+
cd dart-sdk/sdk
217+
./tools/build.py --no-goma --mode release --arch ${{ matrix.target-arch }} --gn-args 'dart_snapshot_kind="app-jit"' --gn-args 'dart_sysroot="alpine"' create_sdk
218+
219+
- name: Archive
220+
run: |
221+
tar -czf dartsdk-linux-${{ matrix.target-arch }}-release.tar.gz -C dart-sdk/sdk/out/Release* -- dart-sdk
222+
223+
- name: Upload Artifact
224+
uses: actions/upload-artifact@v3
225+
with:
226+
name: dartsdk-linux-${{ matrix.target-arch }}-${{ inputs.ref }}
227+
path: dartsdk-linux-${{ matrix.target-arch }}-release.tar.gz
228+
if-no-files-found: error
229+
230+
tag:
231+
needs: [build]
232+
233+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
234+
235+
runs-on: ubuntu-latest
236+
237+
steps:
238+
- name: Checkout
239+
uses: actions/checkout@v3
240+
with:
241+
fetch-depth: 0
242+
ssh-key: ${{ secrets.DEPLOY_KEY }}
243+
244+
- name: Tag
245+
run: |
246+
if git ls-remote --exit-code --tags https://dart.googlesource.com/sdk.git "${{ inputs.ref }}"; then
247+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
248+
git config user.name github-actions[bot]
249+
if test -n "$(git tag -l ${{ inputs.ref }})"; then
250+
echo "Tag ${{ inputs.ref }} has already been created."
251+
exit 0
252+
fi
253+
git tag -m ${{ inputs.ref }} ${{ inputs.ref }}
254+
echo "Tagged ${{ inputs.ref }}."
255+
git push origin refs/tags/${{ inputs.ref }}
256+
echo "Pushed tag ${{ inputs.ref }}."
257+
fi

.github/workflows/release.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
jobs:
9+
build:
10+
uses: ./.github/workflows/build.yml
11+
with:
12+
ref: ${{ github.ref_name }}
13+
14+
release:
15+
needs: [build]
16+
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: write
21+
22+
steps:
23+
- name: Download Artifact
24+
uses: actions/download-artifact@v3
25+
with:
26+
name: dartsdk-linux-x64-${{ github.ref_name }}
27+
28+
- name: Download Artifact
29+
uses: actions/download-artifact@v3
30+
with:
31+
name: dartsdk-linux-ia32-${{ github.ref_name }}
32+
33+
- name: Download Artifact
34+
uses: actions/download-artifact@v3
35+
with:
36+
name: dartsdk-linux-arm64-${{ github.ref_name }}
37+
38+
- name: Download Artifact
39+
uses: actions/download-artifact@v3
40+
with:
41+
name: dartsdk-linux-arm-${{ github.ref_name }}
42+
43+
- name: Release
44+
uses: softprops/action-gh-release@v1
45+
with:
46+
prerelease: ${{ endsWith(github.ref_name, '.beta') || endsWith(github.ref_name, '.dev') }}
47+
files: |
48+
dartsdk-linux-x64-release.tar.gz
49+
dartsdk-linux-ia32-release.tar.gz
50+
dartsdk-linux-arm64-release.tar.gz
51+
dartsdk-linux-arm-release.tar.gz
52+
53+
container:
54+
needs: [release]
55+
56+
runs-on: ubuntu-latest
57+
58+
permissions:
59+
packages: write
60+
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v3
64+
65+
- name: Docker Metadata
66+
id: docker-metadata
67+
uses: docker/metadata-action@v4
68+
with:
69+
images: |
70+
ghcr.io/${{ github.repository }}
71+
tags: |
72+
type=edge
73+
type=ref,event=branch
74+
type=ref,event=pr
75+
type=schedule
76+
type=semver,pattern={{version}}
77+
type=semver,pattern={{major}}.{{minor}}
78+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
79+
80+
- name: Set up QEMU
81+
uses: docker/setup-qemu-action@v2
82+
83+
- name: Set up Docker Buildx
84+
uses: docker/setup-buildx-action@v2
85+
86+
- name: Login to GitHub Container Registry
87+
uses: docker/login-action@v2
88+
with:
89+
registry: ghcr.io
90+
username: ${{ github.actor }}
91+
password: ${{ github.token }}
92+
93+
- name: Build and push
94+
uses: docker/build-push-action@v4
95+
with:
96+
build-args: |
97+
BASEURL=${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}
98+
context: .
99+
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7
100+
push: ${{ !endsWith(github.ref_name, '.beta') && !endsWith(github.ref_name, '.dev') }}
101+
tags: ${{ steps.docker-metadata.outputs.tags }}
102+
labels: ${{ steps.docker-metadata.outputs.labels }}

0 commit comments

Comments
 (0)