Skip to content

Commit

Permalink
Merge pull request dart-lang#16 from dart-lang/main-channel
Browse files Browse the repository at this point in the history
Support main (aka edge) builds
  • Loading branch information
mit-mit committed Jan 19, 2021
2 parents db4ae86 + f7c7b45 commit b77f714
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test latest stable, beta, and dev channels + last stable release
# Test latest stable, beta, dev, and main 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]
sdk: [stable, beta, dev, main, 2.9.3, 2.12.0-29.10.beta]
steps:
- uses: actions/checkout@v2
- uses: ./
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ This [GitHub Action]() installs and sets up of a Dart SDK for use in actions by:

# Usage

## Basic
## Inputs

The action takes the following inputs:

* `sdk`: Which SDK version to setup. Can be specified using one of two forms:
* A specific SDK version, e.g. `2.7.2` or `2.12.0-1.4.beta`
* A release channel, which will install the latest build from that channel.
Available channels are `stable`, `beta`, `dev`, and `main`. See
https://dart.dev/tools/sdk/archive for details.

## Basic example

Install the latest stable SDK, and run Hello World.

Expand Down Expand Up @@ -37,7 +47,7 @@ jobs:
run: dart bin/hello_world.dart
```
## Check static analysis, formatting, and tests
## Check static analysis, formatting, and test example
Various static checks:
Expand All @@ -62,7 +72,7 @@ Various static checks:
run: dart test
```
## Matrix testing
## Matrix testing example
You can create matrix jobs that run tests on multiple operating systems, and
multiple versions of the Dart SDK.
Expand Down Expand Up @@ -101,7 +111,7 @@ jobs:
run: dart test
```
## Testing older Dart SDKs
## Testing older Dart SDKs example
The Dart SDK continously evolves, and new features and tools are added. The Dart
2.10 SDK introduced a new unified `dart` developer tool, which is what we use in
Expand Down Expand Up @@ -154,6 +164,10 @@ jobs:

# Version history

## v0.3

* Added support for installing SDKs from the `main` channel.

## v0.2

* Added support for installing a specific SDK version (e.g. `2.10.0`).
Expand Down
16 changes: 13 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
###############################################################################
# Bash script that downloads and does setup for a Dart SDK. #
# Takes three params; first listed is the default: #
# $1: Dart SDK version/channel: stable|beta|dev|<version_string> #
# $1: Dart SDK version/channel: stable|beta|dev|main|<version_string> #
# $2: Dart channel (DEPRECATED): stable|beta|dev #
# $3: OS: Linux|Windows|macOS #
# $4: ARCH: x64|ia32 #
Expand All @@ -23,7 +23,7 @@ CHANNEL=
VERSION=

# Check for a specific version
if [[ $SDK == stable || $SDK == beta || $SDK == dev ]]
if [[ $SDK == stable || $SDK == beta || $SDK == dev || $SDK == main ]]
then
CHANNEL=$SDK
VERSION=latest
Expand All @@ -37,6 +37,10 @@ else
elif [[ "$SDK" == *"beta"* ]]
then
CHANNEL=beta
elif [[ "$SDK" == *"main"* ]]
then
echo -e "::error::Versions cannot be specified for builds from the main channel."
exit 1
fi
fi

Expand All @@ -48,7 +52,13 @@ echo "Installing Dart SDK version \"${VERSION}\" from the ${CHANNEL} channel on
# Calculate download Url. Based on:
# https://dart.dev/tools/sdk/archive#download-urls
PREFIX="https://storage.googleapis.com/dart-archive/channels"
URL="${PREFIX}/${CHANNEL}/release/${VERSION}/sdk/dartsdk-${OS}-${ARCH}-release.zip"
BUILD="sdk/dartsdk-${OS}-${ARCH}-release.zip"
if [[ $SDK == main ]]
then
URL="${PREFIX}/be/raw/latest/${BUILD}"
else
URL="${PREFIX}/${CHANNEL}/release/${VERSION}/${BUILD}"
fi
echo "Downloading ${URL}..."

# Download installation zip.
Expand Down

0 comments on commit b77f714

Please sign in to comment.