Skip to content

Commit 8e2304c

Browse files
committed
Initial commit
0 parents  commit 8e2304c

File tree

7 files changed

+381
-0
lines changed

7 files changed

+381
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
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

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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+
build:
20+
runs-on: ubuntu-latest
21+
22+
container:
23+
image: docker.io/library/debian
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- host-arch: x64
30+
target-arch: x64
31+
- host-arch: x64
32+
target-arch: ia32
33+
- host-arch: x64
34+
target-arch: arm64
35+
- host-arch: x64
36+
target-arch: arm
37+
38+
steps:
39+
- name: Install build tools
40+
run: |
41+
apt-get update
42+
apt-get install --no-install-recommends -y ca-certificates curl git python3 xz-utils
43+
44+
- name: Setup multiarch
45+
run: |
46+
case ${{ matrix.host-arch }} in
47+
arm64)
48+
dpkg --add-architecture armhf
49+
apt-get update
50+
apt-get install --no-install-recommends -y libc6:armhf
51+
;;
52+
x64)
53+
dpkg --add-architecture i386
54+
apt-get update
55+
apt-get install --no-install-recommends -y libc6:i386
56+
;;
57+
esac
58+
59+
- name: Fetch Dart SDK
60+
id: fetch
61+
run: |
62+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
63+
export DEPOT_TOOLS_UPDATE=0 PATH=$PWD/depot_tools:$PATH
64+
65+
mkdir dart-sdk
66+
cd dart-sdk
67+
gclient config --name sdk https://dart.googlesource.com/sdk.git@${{ inputs.ref }}
68+
echo "target_os = ['android']" | tee -a .gclient
69+
gclient sync --no-history
70+
71+
- name: Build
72+
run: |
73+
cd dart-sdk/sdk
74+
./tools/build.py --no-goma --mode release --os android --arch ${{ matrix.target-arch }} --gn-args 'dart_snapshot_kind="app-jit"' create_sdk
75+
76+
- name: Archive
77+
run: |
78+
tar -czf dartsdk-android-${{ matrix.target-arch }}-release.tar.gz -C dart-sdk/sdk/out/Release* -- dart-sdk
79+
80+
- name: Upload Artifact
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: dartsdk-android-${{ matrix.target-arch }}-${{ inputs.ref }}
84+
path: dartsdk-android-${{ matrix.target-arch }}-release.tar.gz
85+
if-no-files-found: error
86+
87+
tag:
88+
needs: [build]
89+
90+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
91+
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@v3
97+
with:
98+
fetch-depth: 0
99+
ssh-key: ${{ secrets.DEPLOY_KEY }}
100+
101+
- name: Tag
102+
run: |
103+
if git ls-remote --exit-code --tags https://dart.googlesource.com/sdk.git "${{ inputs.ref }}"; then
104+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
105+
git config user.name github-actions[bot]
106+
if test -n "$(git tag -l ${{ inputs.ref }})"; then
107+
echo "Tag ${{ inputs.ref }} has already been created."
108+
exit 0
109+
fi
110+
git tag -m ${{ inputs.ref }} ${{ inputs.ref }}
111+
echo "Tagged ${{ inputs.ref }}."
112+
git push origin refs/tags/${{ inputs.ref }}
113+
echo "Pushed tag ${{ inputs.ref }}."
114+
fi

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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-android-x64-${{ github.ref_name }}
27+
28+
- name: Download Artifact
29+
uses: actions/download-artifact@v3
30+
with:
31+
name: dartsdk-android-ia32-${{ github.ref_name }}
32+
33+
- name: Download Artifact
34+
uses: actions/download-artifact@v3
35+
with:
36+
name: dartsdk-android-arm64-${{ github.ref_name }}
37+
38+
- name: Download Artifact
39+
uses: actions/download-artifact@v3
40+
with:
41+
name: dartsdk-android-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-android-x64-release.tar.gz
49+
dartsdk-android-ia32-release.tar.gz
50+
dartsdk-android-arm64-release.tar.gz
51+
dartsdk-android-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: Download Artifact
66+
uses: actions/download-artifact@v3
67+
with:
68+
name: dartsdk-android-x64-${{ github.ref_name }}
69+
70+
- name: Download Artifact
71+
uses: actions/download-artifact@v3
72+
with:
73+
name: dartsdk-android-ia32-${{ github.ref_name }}
74+
75+
- name: Download Artifact
76+
uses: actions/download-artifact@v3
77+
with:
78+
name: dartsdk-android-arm64-${{ github.ref_name }}
79+
80+
- name: Download Artifact
81+
uses: actions/download-artifact@v3
82+
with:
83+
name: dartsdk-android-arm-${{ github.ref_name }}
84+
85+
- name: Docker Metadata
86+
id: docker-metadata
87+
uses: docker/metadata-action@v4
88+
with:
89+
images: |
90+
ghcr.io/${{ github.repository }}
91+
tags: |
92+
type=edge
93+
type=ref,event=branch
94+
type=ref,event=pr
95+
type=schedule
96+
type=semver,pattern={{version}}
97+
type=semver,pattern={{major}}.{{minor}}
98+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
99+
100+
- name: Set up QEMU
101+
uses: docker/setup-qemu-action@v2
102+
103+
- name: Set up Docker Buildx
104+
uses: docker/setup-buildx-action@v2
105+
106+
- name: Login to GitHub Container Registry
107+
uses: docker/login-action@v2
108+
with:
109+
registry: ghcr.io
110+
username: ${{ github.actor }}
111+
password: ${{ github.token }}
112+
113+
- name: Build and push
114+
uses: docker/build-push-action@v4
115+
with:
116+
context: .
117+
platforms: linux/amd64,linux/arm64
118+
push: ${{ !endsWith(github.ref_name, '.beta') && !endsWith(github.ref_name, '.dev') }}
119+
tags: ${{ steps.docker-metadata.outputs.tags }}
120+
labels: ${{ steps.docker-metadata.outputs.labels }}

.github/workflows/schedule.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: schedule
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
schedule:
11+
- cron: '0 0 * * *'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
latest:
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
channel: [stable, beta, dev]
26+
27+
outputs:
28+
stable-version: ${{ steps.version.outputs.stable-version }}
29+
stable-cache-hit: ${{ steps.cache.outputs.stable-cache-hit }}
30+
beta-version: ${{ steps.version.outputs.beta-version }}
31+
beta-cache-hit: ${{ steps.cache.outputs.beta-cache-hit }}
32+
dev-version: ${{ steps.version.outputs.dev-version }}
33+
dev-cache-hit: ${{ steps.cache.outputs.dev-cache-hit }}
34+
35+
steps:
36+
- name: Get ${{ matrix.channel }} release
37+
run: |
38+
curl -fsSL "https://storage.googleapis.com/dart-archive/channels/${{ matrix.channel }}/release/latest/VERSION" | tee -a VERSION
39+
40+
- name: Get ${{ matrix.channel }} version
41+
id: version
42+
run: |
43+
echo "${{ matrix.channel }}-version=$(yq .version VERSION)" | tee -a $GITHUB_OUTPUT
44+
45+
- name: Cache
46+
id: cache
47+
run: |
48+
if ${{ github.event.schedule && 'true' || 'false' }} && curl -fsSLo /dev/null "${{ github.server_url }}/${{ github.repository }}/releases/tag/$(yq .version VERSION)"; then
49+
echo "${{ matrix.channel }}-cache-hit=true" | tee -a $GITHUB_OUTPUT
50+
else
51+
echo "${{ matrix.channel }}-cache-hit=false" | tee -a $GITHUB_OUTPUT
52+
fi
53+
54+
stable:
55+
needs: [latest]
56+
if: needs.latest.outputs.stable-cache-hit != 'true'
57+
uses: ./.github/workflows/build.yml
58+
with:
59+
ref: ${{ needs.latest.outputs.stable-version }}
60+
secrets: inherit
61+
62+
beta:
63+
needs: [latest]
64+
if: needs.latest.outputs.beta-cache-hit != 'true' && needs.latest.outputs.beta-version != needs.latest.outputs.stable-version
65+
uses: ./.github/workflows/build.yml
66+
with:
67+
ref: ${{ needs.latest.outputs.beta-version }}
68+
secrets: inherit
69+
70+
dev:
71+
needs: [latest]
72+
if: needs.latest.outputs.dev-cache-hit != 'true' && needs.latest.outputs.dev-version != needs.latest.outputs.beta-version && needs.latest.outputs.dev-version != needs.latest.outputs.stable-version
73+
uses: ./.github/workflows/build.yml
74+
with:
75+
ref: ${{ needs.latest.outputs.dev-version }}
76+
secrets: inherit
77+
78+
main:
79+
needs: [latest]
80+
uses: ./.github/workflows/build.yml
81+
with:
82+
ref: main

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ghcr.io/dart-android/toybox
2+
3+
COPY dartsdk-android-x64-release.tar.gz /build/dartsdk-android-x64-release.tar.gz
4+
COPY dartsdk-android-ia32-release.tar.gz /build/dartsdk-android-ia32-release.tar.gz
5+
COPY dartsdk-android-arm64-release.tar.gz /build/dartsdk-android-arm64-release.tar.gz
6+
COPY dartsdk-android-arm-release.tar.gz /build/dartsdk-android-arm-release.tar.gz
7+
8+
RUN case "$(uname -m)" in \
9+
x86_64) \
10+
tar -xzf /build/dartsdk-android-x64-release.tar.gz && mv dart-sdk /system/lib64/dart && \
11+
tar -xzf /build/dartsdk-android-ia32-release.tar.gz && mv dart-sdk /system/lib/dart \
12+
;; \
13+
aarch64) \
14+
tar -xzf /build/dartsdk-android-arm64-release.tar.gz && mv dart-sdk /system/lib64/dart && \
15+
tar -xzf /build/dartsdk-android-arm-release.tar.gz && mv dart-sdk /system/lib/dart \
16+
;; \
17+
esac
18+
19+
FROM ghcr.io/dart-android/toybox
20+
21+
ENV DART_SDK /system/lib64/dart
22+
ENV PATH $DART_SDK/bin:$PATH
23+
24+
COPY --from=0 /system/lib64/dart /system/lib64/dart
25+
COPY --from=0 /system/lib/dart /system/lib/dart

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2023, なつき
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# dart

0 commit comments

Comments
 (0)