Skip to content

Commit

Permalink
Set architecture options from runner's architecture (#264)
Browse files Browse the repository at this point in the history
* feat: Add ARCH_NAME variable and set default ARCH value

* chore: Show runner's os and architecture

* chore: Update actions
  • Loading branch information
koji-1009 authored Feb 5, 2024
1 parent 02b923c commit 14bf530
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
lint_shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ludeeus/action-shellcheck@master
test_channel:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -24,13 +24,16 @@ jobs:
- operating-system: ubuntu-latest
channel: main
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- id: flutter-action
uses: ./
with:
channel: ${{ matrix.channel }}
- name: Echo outputs
run: |
echo RUNNER-OS=${{ runner.os }}
echo RUNNER-ARCH=${{ runner.arch }}
echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
Expand All @@ -47,7 +50,7 @@ jobs:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./
with:
channel: stable
Expand All @@ -60,7 +63,7 @@ jobs:
test_print_output:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: ./setup.sh -t -p | grep 'stable'
shell: bash
- run: ./setup.sh -t -p | grep '3.7.7'
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ runs:
run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -n '${{ inputs.flutter-version }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }}
shell: bash
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
Expand Down
3 changes: 3 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if ! check_command jq; then
fi

OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}')
ARCH_NAME=$(echo "$RUNNER_ARCH" | awk '{print tolower($0)}')
MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases"
MANIFEST_JSON_PATH="releases_$OS_NAME.json"
MANIFEST_URL="$MANIFEST_BASE_URL/$MANIFEST_JSON_PATH"
Expand Down Expand Up @@ -83,6 +84,8 @@ while getopts 'tc:k:pa:n:' flag; do
esac
done

[[ -z $ARCH ]] && ARCH="$ARCH_NAME"

ARR_CHANNEL=("${@:$OPTIND:1}")
CHANNEL="${ARR_CHANNEL[0]}"

Expand Down

0 comments on commit 14bf530

Please sign in to comment.