From a591b7f6b961430034defe379a8190c41b1c5dbf Mon Sep 17 00:00:00 2001 From: nickshorebird Date: Wed, 27 May 2026 09:29:00 -0400 Subject: [PATCH] feat(ci): adopt shorebird_ci workflow w/ required aggregator (#359) * feat(ci): add shorebird_ci-generated workflow w/ required aggregator Generated w/ `shorebird_ci generate --style static --required`. Covers the `shorebird_code_push` Dart package; Rust crates remain on main.yaml. * fix(ci): add dorny, felangel, subpackages to cspell dictionary --- .github/workflows/_shorebird_ci_flutter.yaml | 74 ++++++++++++++++ .github/workflows/shorebird_ci.yaml | 93 ++++++++++++++++++++ cspell.config.yaml | 3 + 3 files changed, 170 insertions(+) create mode 100644 .github/workflows/_shorebird_ci_flutter.yaml create mode 100644 .github/workflows/shorebird_ci.yaml diff --git a/.github/workflows/_shorebird_ci_flutter.yaml b/.github/workflows/_shorebird_ci_flutter.yaml new file mode 100644 index 0000000..e1afbae --- /dev/null +++ b/.github/workflows/_shorebird_ci_flutter.yaml @@ -0,0 +1,74 @@ +# Generated by shorebird_ci --style static. Safe to edit. +# Reusable workflow: CI steps for a single Flutter package. +on: + workflow_call: + inputs: + package_name: + required: true + type: string + package_path: + required: true + type: string + flutter_version: + required: false + default: "" + type: string + has_bloc_lint: + required: false + default: false + type: boolean + has_integration_tests: + required: false + default: false + type: boolean + has_unit_tests: + required: false + default: true + type: boolean + subpackages: + required: false + default: "" + type: string + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ inputs.flutter_version || '' }} + channel: ${{ inputs.flutter_version && '' || 'stable' }} + - name: Setup Bloc Tools + if: inputs.has_bloc_lint + uses: felangel/setup-bloc-tools@v0 + - name: Install Dependencies + working-directory: ${{ inputs.package_path }} + run: | + flutter pub get --no-example + for sub in ${{ inputs.subpackages }}; do + flutter pub get --no-example -C $sub + done + - working-directory: ${{ inputs.package_path }} + run: dart format --set-exit-if-changed . + - working-directory: ${{ inputs.package_path }} + run: flutter analyze . + - name: Bloc Lint + if: inputs.has_bloc_lint + working-directory: ${{ inputs.package_path }} + run: bloc lint . + - if: inputs.has_unit_tests + working-directory: ${{ inputs.package_path }} + run: flutter test --coverage + - if: inputs.has_unit_tests + uses: codecov/codecov-action@v6 + with: + flags: ${{ inputs.package_name }} + working-directory: ${{ inputs.package_path }} + - name: Integration Tests + if: inputs.has_integration_tests + working-directory: ${{ inputs.package_path }} + run: flutter test integration_test diff --git a/.github/workflows/shorebird_ci.yaml b/.github/workflows/shorebird_ci.yaml new file mode 100644 index 0000000..790f5e5 --- /dev/null +++ b/.github/workflows/shorebird_ci.yaml @@ -0,0 +1,93 @@ +# Generated by shorebird_ci --style static. Safe to edit. +# Run `shorebird_ci verify` to check for dep graph drift. +name: Shorebird CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + shorebird_code_push: ${{ steps.filter.outputs.shorebird_code_push }} + shorebird_code_push_example: ${{ steps.filter.outputs.shorebird_code_push_example }} + steps: + - uses: actions/checkout@v6 + with: + # Full history so dorny/paths-filter can diff on push events. + fetch-depth: 0 + - uses: dart-lang/setup-dart@v1 + - run: dart pub global activate shorebird_ci + - name: Verify CI coverage + run: shorebird_ci verify + - uses: dorny/paths-filter@v4 + id: filter + with: + filters: | + shorebird_code_push: + - shorebird_code_push/** + shorebird_code_push_example: + - shorebird_code_push/** + - shorebird_code_push/example/** + + shorebird_code_push: + needs: changes + if: needs.changes.outputs.shorebird_code_push == 'true' + uses: ./.github/workflows/_shorebird_ci_flutter.yaml + with: + package_name: shorebird_code_push + package_path: shorebird_code_push + has_bloc_lint: false + has_unit_tests: true + subpackages: "example" + flutter_version: "" + has_integration_tests: false + + shorebird_code_push_example: + needs: changes + if: needs.changes.outputs.shorebird_code_push_example == 'true' + uses: ./.github/workflows/_shorebird_ci_flutter.yaml + with: + package_name: shorebird_code_push_example + package_path: shorebird_code_push/example + has_bloc_lint: false + has_unit_tests: false + subpackages: "" + flutter_version: "" + has_integration_tests: false + + cspell: + name: CSpell + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - uses: streetsidesoftware/cspell-action@v8 + with: + incremental_files_only: false + config: cspell.config.yaml + + required: + name: required + if: ${{ always() }} + needs: + - changes + - shorebird_code_push + - shorebird_code_push_example + - cspell + runs-on: ubuntu-latest + steps: + - name: Check required jobs + run: | + if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then + echo "One or more required jobs failed or were cancelled." + exit 1 + fi + echo "All required jobs passed (or were skipped because nothing changed)." + diff --git a/cspell.config.yaml b/cspell.config.yaml index be1e802..4d964de 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -38,6 +38,7 @@ words: - Decompressor - dllexport - dlopen + - dorny - downloadables - EACCES - EDQUOT @@ -48,6 +49,7 @@ words: - ENOSPC - EROFS - eseidel + - felangel - ffigen - gclient - hdpi @@ -84,6 +86,7 @@ words: - sigstore - staticlib - subosito + - subpackages - swiftpm - symbolication - tombstoned