chore: update amplify #155
Workflow file for this run
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
name: "Test" | |
on: | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
APP_STORE_CONNECT_APPLE_ID: | |
required: true | |
APP_STORE_CONNECT_ISSUER_ID: | |
required: true | |
APP_STORE_CONNECT_API_KEY_ID: | |
required: true | |
APP_STORE_CONNECT_API_KEY_FILE: | |
required: true | |
APP_STORE_DISTRIBUTION_CERT_ID: | |
required: true | |
APP_STORE_DISTRIBUTION_CERT_KEY_FILE: | |
required: true | |
CODECOV_TOKEN: | |
required: true | |
SECRET_SETTING_TOKEN: | |
required: true | |
outputs: | |
next_version: | |
description: "Version that could be used next without collision, determined while testing the fastlane setup." | |
value: ${{ jobs.test-fastlane.outputs.next_version }} | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
analyze-flutter: | |
name: "Analyze Flutter" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: "Setup empty .env.local" | |
run: cp .env .env.local | |
- name: "Determine Flutter Version" | |
id: flutter-version | |
run: echo "FLUTTER_VERSION=$(jq -r ".flutterSdkVersion" .fvm/fvm_config.json)" >> $GITHUB_OUTPUT | |
- name: "Install Flutter" | |
uses: subosito/[email protected] | |
with: | |
flutter-version: ${{ steps.flutter-version.outputs.FLUTTER_VERSION }} | |
cache: true | |
- name: "Analyze code" | |
run: flutter analyze | |
test-code-gen: | |
name: "Test code gen" | |
runs-on: macos-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: "Setup empty .env.local" | |
run: cp .env .env.local | |
- name: "Determine Flutter Version" | |
id: flutter-version | |
run: echo "FLUTTER_VERSION=$(jq -r ".flutterSdkVersion" .fvm/fvm_config.json)" >> $GITHUB_OUTPUT | |
- name: "Install Flutter" | |
uses: subosito/[email protected] | |
with: | |
flutter-version: ${{ steps.flutter-version.outputs.FLUTTER_VERSION }} | |
cache: true | |
- name: "Check code generation" | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: "Verify files unchanged" | |
uses: tj-actions/verify-changed-files@v16 | |
with: | |
fail-if-changed: true | |
test-flutter: | |
name: "Test Flutter" | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
# permissions: | |
# id-token: write | |
# contents: read | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: "Setup empty .env.local" | |
run: cp .env .env.local | |
- name: "Determine Flutter Version" | |
id: flutter-version | |
run: echo "FLUTTER_VERSION=$(jq -r ".flutterSdkVersion" .fvm/fvm_config.json)" >> $GITHUB_OUTPUT | |
- name: "Install Flutter" | |
uses: subosito/[email protected] | |
with: | |
flutter-version: ${{ steps.flutter-version.outputs.FLUTTER_VERSION }} | |
cache: true | |
# TODO use this to generate `amplifyconfiguration.dart` in pipeline, once possible | |
# - name: "Configure AWS credentials" | |
# uses: aws-actions/configure-aws-credentials@v3 | |
# with: | |
# role-to-assume: arn:aws:iam::118776085668:role/github-actions-amplify-deployment | |
# aws-region: eu-central-1 | |
# - name: "Install Amplify" | |
# run: npm install -g @aws-amplify/cli | |
# - name: "Init Amplify" | |
# run: amplify pull --restore --envName dev --debug --yes | |
- name: "Check dependencies" | |
run: flutter pub get # so pub get doesn't clutter flutter test output | |
- name: "Run Tests" | |
id: run-tests | |
run: flutter test --coverage --suppress-analytics --machine | tee test-report.json # --suppress-analytics needed to have a valid json | |
- name: "Add test results to status check" | |
uses: phoenix-actions/test-reporting@v12 | |
if: always() && (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') | |
with: | |
reporter: dart-json | |
name: "Test Results: Flutter" | |
path: test-report.json | |
- name: "Upload Coverage Report to Codecov" | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/lcov.info | |
fail_ci_if_error: true | |
test-fastlane: | |
name: "Test Fastlane" | |
runs-on: macos-latest | |
env: | |
APP_STORE_CONNECT_APPLE_ID: ${{ secrets.APP_STORE_CONNECT_APPLE_ID }} | |
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} | |
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} | |
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: "Setup Ruby" | |
uses: ruby/setup-ruby@54a18e26dbbb1eabc604f317ade9a5788dddef81 # v1.159.0 | |
with: | |
# using .ruby-version | |
# installing gems automatically | |
bundler-cache: true # requires BUNDLE_GEMFILE | |
- name: "Setup Xcode" | |
uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: latest-stable | |
- name: "Setup App Store Connect API key" | |
env: | |
# 1. `base64 -i AuthKey_<...>.p8 -o AuthKey_<...>.base64` | |
# 2. `pbcopy < AuthKey_<...>.base64` and paste without a newline | |
APP_STORE_CONNECT_API_KEY_FILE: ${{ secrets.APP_STORE_CONNECT_API_KEY_FILE }} | |
run: | | |
mkdir ~/.private_keys | |
echo $APP_STORE_CONNECT_API_KEY_FILE | base64 --decode > ~/.private_keys/AuthKey_${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}.p8 | |
- name: "Setup Google Play Console API key" | |
env: | |
# 1. `base64 -i play-store-credentials.json -o play-store-credentials.base64` | |
# 2. `pbcopy < play-store-credentials.base64` and paste without a newline | |
GOOGLE_PLAY_CONSOLE_API_KEY_FILE: ${{ secrets.GOOGLE_PLAY_CONSOLE_API_KEY_FILE }} | |
run: | | |
echo $GOOGLE_PLAY_CONSOLE_API_KEY_FILE | base64 --decode > ./android/play-store-credentials.json | |
- name: "Check App & Play Store access by calculating next version" | |
run: bundle exec fastlane set_next_version | |
- name: "Read next version from pubspec.yaml" | |
id: pubspec-version | |
run: echo "next_version=$(yq '.version' pubspec.yaml)" >> $GITHUB_OUTPUT | |
- name: "Setup iOS distribution certificate key" | |
env: | |
# automatically generated by previous runs via fastlane | |
APP_STORE_DISTRIBUTION_CERT_KEY_FILE: ${{ secrets.APP_STORE_DISTRIBUTION_CERT_KEY_FILE }} | |
run: | | |
echo $APP_STORE_DISTRIBUTION_CERT_KEY_FILE | base64 --decode > ${{ secrets.APP_STORE_DISTRIBUTION_CERT_ID }}.p12 | |
- name: "Check iOS certificates by ensuring validity" | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
SECRET_SETTING_TOKEN: ${{ secrets.SECRET_SETTING_TOKEN }} | |
run: bundle exec fastlane ios_ensure_valid_distribution_certificate | |
outputs: | |
next_version: ${{ steps.pubspec-version.outputs.next_version }} |