1
0
Fork 0
mirror of https://github.com/subosito/flutter-action.git synced 2024-08-16 10:19:50 +02:00
This commit is contained in:
Bartek Pacia 2024-03-31 16:55:03 +00:00 committed by GitHub
commit 63f6494293
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 103 additions and 20 deletions

View file

@ -61,6 +61,69 @@ jobs:
shell: bash
- run: flutter --version
shell: bash
test_precache_disabled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
channel: stable
flutter-version: 3.19.0
cache: false
precache: false
- run: dart --version
shell: bash
- run: flutter --version
shell: bash
- name: Run first test
run: |
cd $FLUTTER_ROOT/bin/cache/artifacts
ls -lah .
test ! -e material_fonts
shell: bash
- name: Run more tests
run: |
cd $FLUTTER_ROOT/bin/cache/artifacts/engine
test ! -e android-arm
test ! -e android-arm-profile
test ! -e android-arm-release
test ! -e android-arm64
test ! -e android-arm64-profile
test ! -e android-arm64-release
test ! -e linux-x64
test ! -e linux-x64-profile
test ! -e linux-x64-release
test_precache_enabled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
channel: stable
flutter-version: 3.19.0
cache: false
precache: true
- run: dart --version
shell: bash
- run: flutter --version
shell: bash
- name: Run first test
run: |
cd $FLUTTER_ROOT/bin/cache/artifacts
test -d material_fonts
shell: bash
- name: Run more tests
run: |
cd $FLUTTER_ROOT/bin/cache/artifacts/engine
test -d android-arm
test -d android-arm-profile
test -d android-arm-release
test -d android-arm64
test -d android-arm64-profile
test -d android-arm64-release
test -d linux-x64
test -d linux-x64-profile
test -d linux-x64-release
test_print_output:
runs-on: macos-latest
steps:

View file

@ -37,6 +37,10 @@ inputs:
description: 'The architecture of Flutter SDK executable (x64 or arm64)'
required: false
default: '${{ runner.arch }}'
precache:
description: 'Whether to call flutter precache after download'
required: false
default: 'false'
outputs:
CACHE-PATH:
value: '${{ steps.flutter-action.outputs.CACHE-PATH }}'
@ -44,6 +48,7 @@ outputs:
value: '${{ steps.flutter-action.outputs.CACHE-KEY }}'
CHANNEL:
value: '${{ steps.flutter-action.outputs.CHANNEL }}'
description: 'The Flutter build release channel'
VERSION:
value: '${{ steps.flutter-action.outputs.VERSION }}'
ARCHITECTURE:
@ -58,7 +63,7 @@ runs:
- run: chmod +x $GITHUB_ACTION_PATH/setup.sh
shell: bash
- id: flutter-action
run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -d '${{ inputs.pub-cache-path }}' -l '${{ inputs.pub-cache-key }}' -n '${{ inputs.flutter-version }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }}
run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -d '${{ inputs.pub-cache-path }}' -l '${{ inputs.pub-cache-key }}' -n '${{ inputs.flutter-version }}' -x '${{ inputs.precache }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }}
shell: bash
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4

View file

@ -73,8 +73,9 @@ PRINT_ONLY=""
TEST_MODE=false
ARCH=""
VERSION=""
PRECACHE=""
while getopts 'tc:k:d:l:pa:n:' flag; do
while getopts 'tc:k:d:l:pa:x:n:' flag; do
case "$flag" in
c) CACHE_PATH="$OPTARG" ;;
k) CACHE_KEY="$OPTARG" ;;
@ -83,6 +84,7 @@ while getopts 'tc:k:d:l:pa:n:' flag; do
p) PRINT_ONLY=true ;;
t) TEST_MODE=true ;;
a) ARCH="$(echo "$OPTARG" | awk '{print tolower($0)}')" ;;
x) PRECACHE="$OPTARG" ;;
n) VERSION="$OPTARG" ;;
?) exit 2 ;;
esac
@ -96,6 +98,7 @@ CHANNEL="${ARR_CHANNEL[0]}"
[[ -z $CHANNEL ]] && CHANNEL=stable
[[ -z $VERSION ]] && VERSION=any
[[ -z $ARCH ]] && ARCH=x64
[[ -z $PRECACHE ]] && PRECACHE=false
[[ -z $CACHE_PATH ]] && CACHE_PATH="$RUNNER_TEMP/flutter/:channel:-:version:-:arch:"
[[ -z $CACHE_KEY ]] && CACHE_KEY="flutter-:os:-:channel:-:version:-:arch:-:hash:"
[[ -z $PUB_CACHE_KEY ]] && PUB_CACHE_KEY="flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
@ -166,6 +169,7 @@ if [[ "$PRINT_ONLY" == true ]]; then
echo "CHANNEL=$info_channel"
echo "VERSION=$info_version"
echo "ARCHITECTURE=$info_architecture"
echo "PRECACHE=$PRECACHE"
echo "CACHE-KEY=$CACHE_KEY"
echo "CACHE-PATH=$CACHE_PATH"
echo "PUB-CACHE-KEY=$PUB_CACHE_KEY"
@ -173,15 +177,17 @@ if [[ "$PRINT_ONLY" == true ]]; then
exit 0
fi
{
echo "CHANNEL=$info_channel"
echo "VERSION=$info_version"
echo "ARCHITECTURE=$info_architecture"
echo "CACHE-KEY=$CACHE_KEY"
echo "CACHE-PATH=$CACHE_PATH"
echo "PUB-CACHE-KEY=$PUB_CACHE_KEY"
echo "PUB-CACHE-PATH=$PUB_CACHE"
} >>"$GITHUB_OUTPUT"
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
{
echo "CHANNEL=$info_channel"
echo "VERSION=$info_version"
echo "ARCHITECTURE=$info_architecture"
echo "CACHE-KEY=$CACHE_KEY"
echo "CACHE-PATH=$CACHE_PATH"
echo "PUB-CACHE-KEY=$PUB_CACHE_KEY"
echo "PUB-CACHE-PATH=$PUB_CACHE"
} >>"$GITHUB_OUTPUT"
fi
exit 0
fi
@ -199,13 +205,22 @@ if [[ ! -x "$CACHE_PATH/bin/flutter" ]]; then
fi
fi
{
echo "FLUTTER_ROOT=$CACHE_PATH"
echo "PUB_CACHE=$PUB_CACHE"
} >>"$GITHUB_ENV"
if [ -n "${GITHUB_ENV:-}" ]; then
{
echo "FLUTTER_ROOT=$CACHE_PATH"
echo "PUB_CACHE=$PUB_CACHE"
} >>"$GITHUB_ENV"
fi
{
echo "$CACHE_PATH/bin"
echo "$CACHE_PATH/bin/cache/dart-sdk/bin"
echo "$PUB_CACHE/bin"
} >>"$GITHUB_PATH"
if [ -n "${GITHUB_PATH:-}" ]; then
{
echo "$CACHE_PATH/bin"
echo "$CACHE_PATH/bin/cache/dart-sdk/bin"
echo "$PUB_CACHE/bin"
} >>"$GITHUB_PATH"
fi
if [ "$PRECACHE" = true ]; then
echo "Will run precache..."
flutter precache
fi