Skip to content

Commit

Permalink
Add a way to setup raw builds for all channels (#36)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Anna Gringauze committed Jul 19, 2021
1 parent f94040e commit fa07b23
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/dart.yml
Expand Up @@ -13,9 +13,32 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test latest stable, beta, dev, and main channels + last stable release
# Test latest stable, beta, dev channels + last stable release
# prior to the introduction of the unified `dart` developer tool.
sdk: [stable, beta, dev, 2.9.3, 2.12.0-29.10.beta]
flavor: [release]
steps:
- uses: actions/checkout@v2
- uses: ./
with:
sdk: ${{ matrix.sdk }}

- name: Run hello world
run: |
echo "main() { print('hello world'); }" > hello.dart
dart hello.dart
test_raw:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test latest stable, beta, dev, and main channels + last stable release
# prior to the introduction of the unified `dart` developer tool, using
# raw (unsigned) bits.
sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta]
flavor: [raw]
steps:
- uses: actions/checkout@v2
- uses: ./
Expand Down
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -19,6 +19,13 @@ The action takes the following inputs:
Available channels are `stable`, `beta`, `dev`, and `main`. See
https://dart.dev/tools/sdk/archive for details.

* `flavor`: Which build flavor to setup.
* Avaliable build flavors are `raw` and `release`.
* `release` flavor contains published builds.
* `raw` flavor contains unpublished builds, which can be used by developers
to test against SDK versions before a release.
* `main` release channel only supports `raw` build flavor.

* `architecture`: The CPU architecture to setup support for. Valid options are
`x64`, `ia32`, `arm`, and `arm64`. Note that not all CPU architectures are
supported on all operating systems; see https://dart.dev/tools/sdk/archive
Expand Down Expand Up @@ -169,6 +176,9 @@ jobs:

# Version history

## v1.1
* Added a `flavor` option setup.sh to allow downloading unpublished builds.

## v1.0
* Promoted to 1.0 stable.

Expand Down
5 changes: 4 additions & 1 deletion action.yml
Expand Up @@ -12,8 +12,11 @@ inputs:
description: "The CPU architecture ('x64', 'ia32', 'arm', or 'arm64')."
required: false
default: "x64"
flavor:
description: "The build flavor ('raw' or 'release')."
required: false
runs:
using: "composite"
steps:
- run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.sdk }} ${{ runner.os }} ${{ inputs.architecture }}
- run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.sdk }} ${{ runner.os }} ${{ inputs.architecture }} ${{ inputs.flavor }}
shell: bash
24 changes: 22 additions & 2 deletions setup.sh
Expand Up @@ -41,7 +41,27 @@ fi
OS="${2:-Linux}"
ARCH="${3:-x64}"
OS=$(echo "$OS" | awk '{print tolower($0)}')
echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel on ${OS}-${ARCH}"

DEFAULT_FLAVOR=release
if [[ $SDK == main ]]
then
DEFAULT_FLAVOR=raw
fi

FLAVOR="${4:-$DEFAULT_FLAVOR}"
if ! [[ $FLAVOR == raw || $FLAVOR == release ]]
then
echo -e "::error::Unrecognized build flavor \"${FLAVOR}\"."
exit 1
fi

if [[ $SDK == main && $FLAVOR != raw ]]
then
echo -e "::error::Main channel only supports raw build flavor."
exit 1
fi

echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel (${FLAVOR}) on ${OS}-${ARCH}"

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

Expand Down

0 comments on commit fa07b23

Please sign in to comment.