Skip to content

Commit fa07b23

Browse files
author
Anna Gringauze
authored
Add a way to setup raw builds for all channels (#36)
* Add a way to setup raw builds for all channels This allow developers reying on SDK changes to land and test changes in other packages using a raw dev build so we can validate changes, publish them, and roll to dependent packages (such as flutter) faster. Closes: #29 * Addressed CR comments
1 parent f94040e commit fa07b23

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

.github/workflows/dart.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,32 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
# Test latest stable, beta, dev, and main channels + last stable release
16+
# Test latest stable, beta, dev channels + last stable release
1717
# prior to the introduction of the unified `dart` developer tool.
18+
sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta]
19+
flavor: [release]
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: ./
23+
with:
24+
sdk: ${{ matrix.sdk }}
25+
26+
- name: Run hello world
27+
run: |
28+
echo "main() { print('hello world'); }" > hello.dart
29+
dart hello.dart
30+
31+
test_raw:
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [ubuntu-latest, macos-latest, windows-latest]
37+
# Test latest stable, beta, dev, and main channels + last stable release
38+
# prior to the introduction of the unified `dart` developer tool, using
39+
# raw (unsigned) bits.
1840
sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta]
41+
flavor: [raw]
1942
steps:
2043
- uses: actions/checkout@v2
2144
- uses: ./

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ The action takes the following inputs:
1919
Available channels are `stable`, `beta`, `dev`, and `main`. See
2020
https://dart.dev/tools/sdk/archive for details.
2121

22+
* `flavor`: Which build flavor to setup.
23+
* Avaliable build flavors are `raw` and `release`.
24+
* `release` flavor contains published builds.
25+
* `raw` flavor contains unpublished builds, which can be used by developers
26+
to test against SDK versions before a release.
27+
* `main` release channel only supports `raw` build flavor.
28+
2229
* `architecture`: The CPU architecture to setup support for. Valid options are
2330
`x64`, `ia32`, `arm`, and `arm64`. Note that not all CPU architectures are
2431
supported on all operating systems; see https://dart.dev/tools/sdk/archive
@@ -169,6 +176,9 @@ jobs:
169176

170177
# Version history
171178

179+
## v1.1
180+
* Added a `flavor` option setup.sh to allow downloading unpublished builds.
181+
172182
## v1.0
173183
* Promoted to 1.0 stable.
174184

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ inputs:
1212
description: "The CPU architecture ('x64', 'ia32', 'arm', or 'arm64')."
1313
required: false
1414
default: "x64"
15+
flavor:
16+
description: "The build flavor ('raw' or 'release')."
17+
required: false
1518
runs:
1619
using: "composite"
1720
steps:
18-
- run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.sdk }} ${{ runner.os }} ${{ inputs.architecture }}
21+
- run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.sdk }} ${{ runner.os }} ${{ inputs.architecture }} ${{ inputs.flavor }}
1922
shell: bash

setup.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,27 @@ fi
4141
OS="${2:-Linux}"
4242
ARCH="${3:-x64}"
4343
OS=$(echo "$OS" | awk '{print tolower($0)}')
44-
echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel on ${OS}-${ARCH}"
44+
45+
DEFAULT_FLAVOR=release
46+
if [[ $SDK == main ]]
47+
then
48+
DEFAULT_FLAVOR=raw
49+
fi
50+
51+
FLAVOR="${4:-$DEFAULT_FLAVOR}"
52+
if ! [[ $FLAVOR == raw || $FLAVOR == release ]]
53+
then
54+
echo -e "::error::Unrecognized build flavor \"${FLAVOR}\"."
55+
exit 1
56+
fi
57+
58+
if [[ $SDK == main && $FLAVOR != raw ]]
59+
then
60+
echo -e "::error::Main channel only supports raw build flavor."
61+
exit 1
62+
fi
63+
64+
echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel (${FLAVOR}) on ${OS}-${ARCH}"
4565

4666
# Calculate download Url. Based on:
4767
# https://dart.dev/tools/sdk/archive#download-urls
@@ -51,7 +71,7 @@ if [[ $SDK == main ]]
5171
then
5272
URL="${PREFIX}/be/raw/latest/${BUILD}"
5373
else
54-
URL="${PREFIX}/${CHANNEL}/release/${VERSION}/${BUILD}"
74+
URL="${PREFIX}/${CHANNEL}/${FLAVOR}/${VERSION}/${BUILD}"
5575
fi
5676
echo "Downloading ${URL}..."
5777

0 commit comments

Comments
 (0)