Skip to content

Run code coverage task only when the threshold is defined #12

Run code coverage task only when the threshold is defined

Run code coverage task only when the threshold is defined #12

name: Flutter Branch Workflow
env:
ENVIRONMENT_FILE: .env
on:
workflow_call:
inputs:
ios-build-arguments:
description: "any extra arguments such as using sksl or passing a variable using --dart-define etc. for iOS build"
type: string
required: false
android-build-arguments:
description: "any extra arguments such as using sksl or passing a variable using --dart-define etc. for Android build"
type: string
required: false
working-directory:
description: "the directory to run each job of the workflow in"
type: string
default: "."
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-build-number:
runs-on: [self-hosted]
outputs:
build-number: ${{ steps.build-number-generator.outputs.build-number }}
steps:
- name: Generate Build Number
id: build-number-generator
run: |
build_number=$(date +%s)
echo "build-number=$build_number" >> $GITHUB_OUTPUT
echo "Build Number: $build_number"
lint:
runs-on: [self-hosted]
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: QuickBirdEng/actions/checkout-ssh@main
with:
ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY_FOR_GITHUB_PRIVATE_REPOS }}
- uses: QuickBirdEng/actions/setup-flutter@main
with:
working-directory: ${{ inputs.working-directory }}
- run: flutter analyze
test:
runs-on: [self-hosted]
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: QuickBirdEng/actions/checkout-ssh@main
with:
ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY_FOR_GITHUB_PRIVATE_REPOS }}
- uses: QuickBirdEng/actions/setup-flutter@main
with:
working-directory: ${{ inputs.working-directory }}
- run: flutter test --dart-define STAGE=mock
test-coverage:
runs-on: [self-hosted]
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Conditional Check (to skip job)

Check failure on line 71 in .github/workflows/flutter-branch.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/flutter-branch.yml

Invalid workflow file

You have an error in your yaml syntax on line 71
run: [[ '${{ env.CODE_COVERAGE_FILE_PATH }}' == '' ]] && echo "Skipping job" && exit 0
- uses: QuickBirdEng/actions/checkout-ssh@main
with:
ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY_FOR_GITHUB_PRIVATE_REPOS }}
- uses: QuickBirdEng/actions/setup-flutter@main
with:
working-directory: ${{ inputs.working-directory }}
- run: flutter test --coverage --dart-define STAGE=mock
- uses: QuickBirdEng/actions/flutter-coverage@main
with:
path: ${{ env.CODE_COVERAGE_FILE_PATH }}
min_coverage: ${{ env.CODE_COVERAGE }}
exclude: ${{ env.CODE_COVERAGE_EXLUDE_FILE }}
build-ios:
runs-on: [self-hosted, macOS]
needs: [generate-build-number, test, lint]
steps:
- uses: QuickBirdEng/actions/checkout-ssh@main
with:
ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY_FOR_GITHUB_PRIVATE_REPOS }}
- uses: QuickBirdEng/actions/flutter-build@main
with:
build-number: ${{ needs.generate-build-number.outputs.build-number }}
build-type: "ipa"
build-arguments: --no-codesign ${{ inputs.ios-build-arguments }}
working-directory: ${{ inputs.working-directory }}
build-android:
runs-on: [self-hosted]
needs: [generate-build-number, test, lint]
steps:
- uses: QuickBirdEng/actions/checkout-ssh@main
with:
ssh-private-key: ${{ secrets.CI_SSH_PRIVATE_KEY_FOR_GITHUB_PRIVATE_REPOS }}
- uses: QuickBirdEng/actions/setup-android@main
with:
key-store-file-content: ${{ secrets.ANDROID_KEYSTORE_FILE_CONTENT }}
key-store-password: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
signing-key-alias: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
signing-key-password: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
qbs-maven-username: ${{ secrets.QBS_DEV_MAVEN_USERNAME }}
qbs-maven-password: ${{ secrets.QBS_DEV_MAVEN_PASSWORD }}
- uses: QuickBirdEng/actions/flutter-build@main
with:
build-number: ${{ needs.generate-build-number.outputs.build-number }}
build-type: "apk"
build-arguments: ${{ inputs.android-build-arguments }}
working-directory: ${{ inputs.working-directory }}