Compare commits

..

6 Commits

Author SHA1 Message Date
Alif Rachmawadi
f95a8c953b add actions/cache support
Some checks failed
Main workflow / test_channel (beta, ubuntu-latest) (push) Failing after 8s
Main workflow / test_channel (dev, ubuntu-latest) (push) Failing after 18s
Main workflow / test_channel (stable, ubuntu-latest) (push) Failing after 8s
Main workflow / test_version (2.5.3) (push) Failing after 33s
Main workflow / test_any_channel (push) Failing after 15s
Main workflow / test_version (1) (push) Failing after 2m16s
Main workflow / test_version (2.x) (push) Failing after 32s
Main workflow / test_version (v1.12) (push) Failing after 23s
Main workflow / test_with_cache (push) Failing after 1m15s
Main workflow / test_channel (beta, macos-latest) (push) Failing after 3s
Main workflow / test_channel (dev, macos-latest) (push) Failing after 2s
Main workflow / test_channel (stable, macos-latest) (push) Failing after 2s
Main workflow / test_channel (beta, windows-latest) (push) Has been cancelled
Main workflow / test_channel (dev, windows-latest) (push) Has been cancelled
Main workflow / test_channel (stable, windows-latest) (push) Has been cancelled
Main workflow / test_master_channel (push) Has been cancelled
2022-01-07 04:54:02 +00:00
Alif Rachmawadi
3dae472464 update readme 2022-01-06 16:00:13 +00:00
Alif Rachmawadi
523b0faa40 update readme for linux desktop dependencies (closes #49) 2022-01-06 11:45:16 +00:00
Alif Rachmawadi
813937b170 update readme for desktop build (closes #86) 2022-01-06 11:17:49 +00:00
Alif Rachmawadi
8af4ab61aa update readme 2022-01-06 11:12:10 +00:00
Alif Rachmawadi
59a5481c7d fix PUB_CACHE env
Some checks failed
Main workflow / test_channel (beta, ubuntu-latest) (push) Failing after 16s
Main workflow / test_channel (dev, ubuntu-latest) (push) Failing after 16s
Main workflow / test_version (1) (push) Failing after 7s
Main workflow / test_version (v1.12) (push) Failing after 14s
Main workflow / test_channel (stable, ubuntu-latest) (push) Failing after 19s
Main workflow / test_version (2.5.3) (push) Failing after 7s
Main workflow / test_version (2.x) (push) Failing after 14s
Main workflow / test_any_channel (push) Failing after 15s
Main workflow / test_channel (beta, macos-latest) (push) Failing after 2s
Main workflow / test_channel (dev, macos-latest) (push) Failing after 2s
Main workflow / test_channel (stable, macos-latest) (push) Failing after 2s
Main workflow / test_channel (dev, windows-latest) (push) Has been cancelled
Main workflow / test_channel (stable, windows-latest) (push) Has been cancelled
Main workflow / test_master_channel (push) Has been cancelled
Main workflow / test_channel (beta, windows-latest) (push) Has been cancelled
2022-01-06 10:46:35 +00:00
3 changed files with 87 additions and 37 deletions

View File

@@ -16,9 +16,9 @@ jobs:
- name: Print FLUTTER_ROOT - name: Print FLUTTER_ROOT
shell: bash shell: bash
run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT" run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT"
- name: Print PUBCACHE - name: Print PUB_CACHE
shell: bash shell: bash
run: echo "PUBCACHE set to $PUBCACHE" run: echo "PUB_CACHE set to $PUB_CACHE"
- name: Run dart --version - name: Run dart --version
shell: bash shell: bash
run: dart --version run: dart --version
@@ -72,3 +72,22 @@ jobs:
- name: Run flutter --version - name: Run flutter --version
shell: bash shell: bash
run: flutter --version 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

View File

@@ -1,8 +1,8 @@
# flutter-action # 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: Use specific version and channel:
@@ -113,22 +113,51 @@ jobs:
- run: flutter build windows - run: flutter build windows
``` ```
Matrix Testing: Build for Linux desktop:
```yaml ```yaml
jobs: jobs:
test: build:
name: Test on ${{ matrix.os }} runs-on: ubuntu-latest
runs-on: ${{ matrix.os }} steps:
strategy: - uses: actions/checkout@v2
matrix: - uses: subosito/flutter-action@v2
os: [ubuntu-latest, windows-latest, macos-latest] with:
steps: channel: beta
- uses: actions/checkout@v2 - run: |
- uses: subosito/flutter-action@v2 sudo apt-get update -y
with: sudo apt-get install -y ninja-build libgtk-3-dev
flutter-version: '1.20.2' - run: flutter config --enable-linux-desktop
channel: 'beta' - run: flutter build linux
- run: dart --version ```
- run: flutter --version
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
``` ```

View File

@@ -64,31 +64,33 @@ download_archive() {
CHANNEL="$1" CHANNEL="$1"
VERSION="$2" 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 if [[ $OS_NAME == windows ]]; then
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter" FLUTTER_ROOT="${RUNNER_TOOL_CACHE}\\flutter"
PUBCACHE="${USERPROFILE}\\.pub-cache" PUB_CACHE="${USERPROFILE}\\.pub-cache"
else else
FLUTTER_ROOT="${RUNNER_TOOL_CACHE}/flutter" 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 fi
echo "FLUTTER_ROOT=${FLUTTER_ROOT}" >>$GITHUB_ENV 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" >>$GITHUB_PATH
echo "${FLUTTER_ROOT}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH echo "${FLUTTER_ROOT}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH
echo "${PUBCACHE}/bin" >>$GITHUB_PATH echo "${PUB_CACHE}/bin" >>$GITHUB_PATH