Skip to content

Commit

Permalink
feat: precache
Browse files Browse the repository at this point in the history
  • Loading branch information
wrbl606 committed Jul 12, 2024
1 parent 9ec210c commit 3305985
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@ jobs:
- uses: ./
- run: flutter --version
- run: dart pub global activate git_helper && git_helper -h
test-beta-install:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
channel: 'beta'
- run: flutter --version
- run: dart pub global activate git_helper && git_helper -h
test-precache:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with:
precache: '--web'
- run: flutter --version
- run: dart pub global activate git_helper && git_helper -h
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Install Flutter SDK'
description: 'Dart and Flutter CLIs available for your GitHub Action'
author: 'Marcin Wróblewski'
author: 'Marcin Wróblewski, Monterail Sp. z o.o. (monterail.com)'
branding:
color: 'white'
icon: 'download'
Expand All @@ -9,10 +9,14 @@ inputs:
description: 'Desired Flutter channel'
required: false
default: 'stable'
precache:
description: 'Comma-separated platforms list to precache'
required: false
default: ''
runs:
using: 'composite'
steps:
- run: chmod +x $GITHUB_ACTION_PATH/install-flutter-sdk.sh
shell: bash
- run: $GITHUB_ACTION_PATH/install-flutter-sdk.sh -c ${{ inputs.channel }}
- run: $GITHUB_ACTION_PATH/install-flutter-sdk.sh -c ${{ inputs.channel }} -p ${{ inputs.precache }}
shell: bash
7 changes: 6 additions & 1 deletion install-flutter-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

CHANNEL="stable"
while getopts 'v:c:' param; do
while getopts 'c:p:' param; do
case $param in
c) CHANNEL="$OPTARG" ;;
p) PRECACHE="$OPTARG" ;;
esac
done

Expand All @@ -16,3 +17,7 @@ git clone -b "$CHANNEL" https://github.com/flutter/flutter.git "$FLUTTER_PATH"
echo "$HOME/.pub-cache/bin" # POSIX
echo "$LOCALAPPDATA\Pub\Cache\bin" # Windows
} >> "$GITHUB_PATH"

if [ -z ${PRECACHE+x} ]; then
flutter precache $PRECACHE
fi

0 comments on commit 3305985

Please sign in to comment.