-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fp/collection-keypath-new
- Loading branch information
Showing
23 changed files
with
264 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Setup runner | ||
description: Setup the runner with the necessary tools and dependencies. | ||
|
||
inputs: | ||
flutter-version: | ||
description: Flutter version to use. | ||
default: stable | ||
cache-key: | ||
description: Cache key to use for restoring and saving the cache. | ||
default: ${{ hashFiles('**/pubspec.yaml') }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup environment | ||
# By forcing puro (and hence the pub-cache) onto the same drive as the checkout, | ||
# we can avoid symlink issue between local and network drives on windows. | ||
id: setup | ||
shell: bash | ||
run: | | ||
export PURO_ROOT=$(dirname $GITHUB_WORKSPACE)/puro | ||
mkdir -p $PURO_ROOT | ||
echo $PURO_ROOT/bin >> $GITHUB_PATH | ||
echo $PURO_ROOT/shared/pub_cache/bin/ >> $GITHUB_PATH | ||
echo $PURO_ROOT/envs/default/flutter/bin/ >> $GITHUB_PATH | ||
echo PURO_ROOT=$PURO_ROOT >> $GITHUB_ENV | ||
echo PUB_CACHE=$PURO_ROOT/shared/pub_cache >> $GITHUB_ENV | ||
echo MELOS_SDK_PATH=$PURO_ROOT/envs/default/flutter/ >> $GITHUB_ENV | ||
echo "week=$(date +'%Y-%U')" >> $GITHUB_OUTPUT | ||
- name: Restore cache | ||
# TODO: Avoid skipping restore on Windows | ||
# (see https://github.com/pingbird/puro/issues/87) | ||
if: runner.os != 'Windows' | ||
id: restore | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ env.PURO_ROOT }} | ||
key: setup-runner-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup.outputs.week }}-${{ inputs.cache-key }} | ||
restore-keys: setup-runner-${{ runner.os }}-${{ runner.arch }}- | ||
|
||
- name: Install puro (posix) | ||
# See https://puro.dev/ | ||
# Skip on any cache hit (partial or full) | ||
if: runner.os != 'Windows' && steps.restore.outputs.cache-matched-key == '' | ||
shell: bash | ||
run: curl -sS -o- https://puro.dev/install.sh | PURO_VERSION="1.4.6" bash | ||
|
||
- name: Install puro (windows) | ||
# We always install on windows, as we currently don't restore a cache (see TODO above) | ||
if: runner.os == 'Windows' && steps.restore.outputs.cache-matched-key == '' | ||
shell: pwsh | ||
run: >- | ||
Invoke-WebRequest | ||
-Uri "https://puro.dev/builds/1.4.6/windows-x64/puro.exe" | ||
-OutFile "$Env:PURO_ROOT"; | ||
&"$Env:PURO_ROOT\puro.exe" install-puro --promote | ||
- name: Upgrade puro and flutter | ||
shell: bash | ||
run: | | ||
puro upgrade-puro | ||
puro use --global ${{ inputs.flutter-version }} | ||
puro upgrade ${{ inputs.flutter-version }} | ||
puro gc | ||
- name: Activate melos | ||
if: steps.restore.outputs.cache-matched-key == '' | ||
shell: bash | ||
run: puro pub global run melos --version || puro pub global activate melos | ||
|
||
- name: Melos bootstrap | ||
shell: bash | ||
run: puro pub global run melos bootstrap | ||
|
||
- name: Save cache | ||
# Saving on feature branches will only benefit reruns, so we don't bother. | ||
# Feature branches inherit the cache from the main branch anyway. | ||
# This saves on cache storage. | ||
if: github.ref == 'refs/heads/main' && steps.restore.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ env.PURO_ROOT }} | ||
key: ${{ steps.restore.outputs.cache-primary-key }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.