Skip to content

chore: use github-app for authenticating Validation workflow. #78

chore: use github-app for authenticating Validation workflow.

chore: use github-app for authenticating Validation workflow. #78

Workflow file for this run

# Runs flutter test and CHANGELOG.md validation on every PR to main.
# Failed goldens are uploaded and can be seen in the artifact summary of the job.
name: Validate
on: [push, pull_request, workflow_dispatch]
# Ensure that new pushes/updates cancel running jobs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: macos-latest
outputs:
token: ${{ steps.app-token.outputs.token }}
steps:
- name: Generate Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APPBAKERYGITHUBAPP_APPID }}
private-key: ${{ secrets.APPBAKERYGITHUBAPP_PRIVATEKEY }}
- name: Checkout design_system_flutter code.
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Parse flutter version and channel specified in .fvm into env vars.
uses: kuhnroyal/flutter-fvm-config-action@v2
- name: Clone flutter version specified in .fvm.
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
cache: true
- name: Run flutter doctor.
run: flutter doctor -v
- name: Install dependencies.
run: flutter pub get
- name: Run flutter test.
id: test
run: flutter test
- name: Upload goldens if tests fail.
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test.conclusion == 'failure' }}
with:
name: goldens
path: test/failures/
retention-days: 3
changelog-test:
runs-on: ubuntu-latest
steps:
- name: Generate Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APPBAKERYGITHUBAPP_APPID }}
private-key: ${{ secrets.APPBAKERYGITHUBAPP_PRIVATEKEY }}
- name: Clone Repository.
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Read Changelog and validate.
uses: mindsers/[email protected]
with:
validation_level: "error"
build-android:
name: "Build Android apk"
runs-on: ubuntu-latest
needs: [test, changelog-test]
defaults:
run:
working-directory: example
strategy:
fail-fast: false
matrix:
sdk: ["3.16.9", ""]
steps:
- uses: actions/checkout@v4
with:
token: ${{ needs.test.outputs.token }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.sdk }}
cache: true
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: 'gradle'
- run: flutter pub get
- name: Build appbundle.
run: flutter build appbundle --profile --no-pub
- name: Upload appbundle as artifact.
uses: actions/upload-artifact@v4
if: ${{ matrix.sdk == '' && github.event_name == 'pull_request' }}
with:
name: app-profile.aab
path: example/build/app/outputs/bundle/profile/
retention-days: 3
token: ${{ needs.test.outputs.token }}
build-iOS:
name: Build iOS package
runs-on: macos-latest
needs: [test, changelog-test]
defaults:
run:
working-directory: example
strategy:
fail-fast: false
matrix:
sdk: ["3.16.9", ""]
steps:
- uses: actions/checkout@v4
with:
token: ${{ needs.test.outputs.token }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.sdk }}
cache: true
- run: flutter pub get
- name: Build iOS package
run: flutter build ios --simulator
- name: Upload Runner.app as artifact
if: ${{ matrix.sdk == '' && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: fdsm-example.app
path: example/build/ios/iphonesimulator
retention-days: 3
token: ${{ needs.test.outputs.token }}