|
| 1 | +name: swiftgen |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on PRs and pushes to the default branch. |
| 5 | + push: |
| 6 | + branches: [main, stable] |
| 7 | + paths: |
| 8 | + - '.github/workflows/swiftgen.yaml' |
| 9 | + - 'pkgs/swiftgen/**' |
| 10 | + pull_request: |
| 11 | + branches: [main, stable] |
| 12 | + paths: |
| 13 | + - '.github/workflows/swiftgen.yaml' |
| 14 | + - 'pkgs/ffigen/**' |
| 15 | + - 'pkgs/objective_c/**' |
| 16 | + - 'pkgs/swift2objc/**' |
| 17 | + - 'pkgs/swiftgen/**' |
| 18 | + schedule: |
| 19 | + - cron: "0 0 * * 0" |
| 20 | + |
| 21 | +env: |
| 22 | + PUB_ENVIRONMENT: bot.github |
| 23 | + |
| 24 | +jobs: |
| 25 | + # Check code formatting and static analysis. |
| 26 | + analyze: |
| 27 | + runs-on: macos-latest |
| 28 | + defaults: |
| 29 | + run: |
| 30 | + working-directory: pkgs/swiftgen/ |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 35 | + - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 |
| 36 | + with: |
| 37 | + channel: 'stable' |
| 38 | + - id: install |
| 39 | + name: Install dependencies |
| 40 | + run: flutter pub get |
| 41 | + - name: Check formatting |
| 42 | + run: dart format --output=none --set-exit-if-changed . |
| 43 | + if: always() && steps.install.outcome == 'success' |
| 44 | + - name: Analyze code |
| 45 | + run: dart analyze --fatal-infos |
| 46 | + if: always() && steps.install.outcome == 'success' |
| 47 | + |
| 48 | + test-mac: |
| 49 | + needs: analyze |
| 50 | + runs-on: 'macos-latest' |
| 51 | + defaults: |
| 52 | + run: |
| 53 | + working-directory: pkgs/swiftgen/ |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 56 | + - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 |
| 57 | + with: |
| 58 | + channel: 'stable' |
| 59 | + - name: Install dependencies |
| 60 | + run: flutter pub get |
| 61 | + - name: Install ObjC dependencies |
| 62 | + working-directory: pkgs/objective_c/ |
| 63 | + run: flutter pub get |
| 64 | + - name: Build ObjC test dylib |
| 65 | + working-directory: pkgs/objective_c/ |
| 66 | + # TODO(https://github.com/dart-lang/native/issues/1068): Remove this. |
| 67 | + run: dart test/setup.dart |
| 68 | + - name: Install coverage |
| 69 | + run: dart pub global activate coverage |
| 70 | + - name: Run VM tests and collect coverage |
| 71 | + run: dart pub global run coverage:test_with_coverage --scope-output=swiftgen |
| 72 | + - name: Upload coverage |
| 73 | + uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b |
| 74 | + with: |
| 75 | + flag-name: swiftgen |
| 76 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + parallel: true |
| 78 | + path-to-lcov: pkgs/swiftgen/coverage/lcov.info |
| 79 | + - name: Upload coverage |
| 80 | + uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b |
| 81 | + with: |
| 82 | + carryforward: "ffigen,jni,jnigen,native_pkgs_macos,native_pkgs_ubuntu,native_pkgs_windows,objective_c,swift2objc,swiftgen" |
| 83 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + parallel-finished: true |
0 commit comments