Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f95a8c953b | ||
|
|
3dae472464 | ||
|
|
523b0faa40 | ||
|
|
813937b170 | ||
|
|
8af4ab61aa | ||
|
|
59a5481c7d |
23
.github/workflows/workflow.yml
vendored
23
.github/workflows/workflow.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
||||
- name: Print FLUTTER_ROOT
|
||||
shell: bash
|
||||
run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT"
|
||||
- name: Print PUBCACHE
|
||||
- name: Print PUB_CACHE
|
||||
shell: bash
|
||||
run: echo "PUBCACHE set to $PUBCACHE"
|
||||
run: echo "PUB_CACHE set to $PUB_CACHE"
|
||||
- name: Run dart --version
|
||||
shell: bash
|
||||
run: dart --version
|
||||
@@ -72,3 +72,22 @@ jobs:
|
||||
- name: Run flutter --version
|
||||
shell: bash
|
||||
run: flutter --version
|
||||
test_with_cache:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ runner.tool_cache }}/flutter
|
||||
key: flutter-2.5.0-stable
|
||||
- uses: ./
|
||||
with:
|
||||
channel: stable
|
||||
flutter-version: 2.5.0
|
||||
- name: Run dart --version
|
||||
shell: bash
|
||||
run: dart --version
|
||||
- name: Run flutter --version
|
||||
shell: bash
|
||||
run: flutter --version
|
||||
|
||||
63
README.md
63
README.md
@@ -1,8 +1,8 @@
|
||||
# flutter-action
|
||||
|
||||
This action sets up a flutter environment for use in actions. It works on Linux, Windows, and macOS.
|
||||
Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
Use specific version and channel:
|
||||
|
||||
@@ -113,22 +113,51 @@ jobs:
|
||||
- run: flutter build windows
|
||||
```
|
||||
|
||||
Matrix Testing:
|
||||
Build for Linux desktop:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
test:
|
||||
name: Test on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '1.20.2'
|
||||
channel: 'beta'
|
||||
- run: dart --version
|
||||
- run: flutter --version
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: beta
|
||||
- run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build libgtk-3-dev
|
||||
- run: flutter config --enable-linux-desktop
|
||||
- run: flutter build linux
|
||||
```
|
||||
|
||||
Build for macOS desktop:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: beta
|
||||
- run: flutter config --enable-macos-desktop
|
||||
- run: flutter build macos
|
||||
```
|
||||
|
||||
Integration with actions/cache:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ runner.tool_cache }}/flutter
|
||||
key: flutter-2.5.0-stable
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
flutter-version: 2.5.0
|
||||
- run: flutter --version
|
||||
```
|
||||
|
||||
38
setup.sh
38
setup.sh
@@ -64,31 +64,33 @@ download_archive() {
|
||||
CHANNEL="$1"
|
||||
VERSION="$2"
|
||||
|
||||
if [[ $CHANNEL == master ]]; then
|
||||
git clone -b master https://github.com/flutter/flutter.git "$RUNNER_TOOL_CACHE/flutter"
|
||||
else
|
||||
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION)
|
||||
|
||||
if [[ $VERSION_MANIFEST == null ]]; then
|
||||
echo "Unable to determine Flutter version for $CHANNEL $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
||||
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
||||
fi
|
||||
|
||||
if [[ $OS_NAME == windows ]]; then
|
||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
|
||||
PUBCACHE="${USERPROFILE}\\.pub-cache"
|
||||
PUB_CACHE="${USERPROFILE}\\.pub-cache"
|
||||
else
|
||||
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter"
|
||||
PUBCACHE="${HOME}/.pub-cache"
|
||||
PUB_CACHE="${HOME}/.pub-cache"
|
||||
fi
|
||||
|
||||
if [[ ! -x "${FLUTTER_ROOT}/bin/flutter" ]]; then
|
||||
if [[ $CHANNEL == master ]]; then
|
||||
git clone -b master https://github.com/flutter/flutter.git "$RUNNER_TOOL_CACHE/flutter"
|
||||
else
|
||||
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION)
|
||||
|
||||
if [[ $VERSION_MANIFEST == null ]]; then
|
||||
echo "Unable to determine Flutter version for $CHANNEL $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive')
|
||||
download_archive "$ARCHIVE_PATH" "$RUNNER_TOOL_CACHE"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV
|
||||
echo "PUB_CACHE=${PUBCACHE}" >>$GITHUB_ENV
|
||||
echo "PUB_CACHE=${PUB_CACHE}" >>$GITHUB_ENV
|
||||
|
||||
echo "${FLUTTER_ROOT}/bin" >>$GITHUB_PATH
|
||||
echo "${FLUTTER_ROOT}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH
|
||||
echo "${PUBCACHE}/bin" >>$GITHUB_PATH
|
||||
echo "${PUB_CACHE}/bin" >>$GITHUB_PATH
|
||||
|
||||
Reference in New Issue
Block a user