|
| 1 | +name: All tests |
| 2 | +permissions: read-all |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + schedule: |
| 10 | + - cron: "0 0 * * 0" # runs on every Sunday |
| 11 | + |
| 12 | +env: |
| 13 | + PUB_ENVIRONMENT: bot.github |
| 14 | + DART_SDK_VERSION: '3.9.0' |
| 15 | + |
| 16 | +jobs: |
| 17 | + app_build_only: |
| 18 | + name: app/ (build only) |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Cache PUB_CACHE |
| 22 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 |
| 23 | + with: |
| 24 | + path: ~/.pub-cache |
| 25 | + key: ${{runner.os}}-pub-cache |
| 26 | + - name: Setup Dart SDK |
| 27 | + uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c |
| 28 | + with: |
| 29 | + sdk: ${{env.DART_SDK_VERSION}} |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 32 | + - run: dart pub get |
| 33 | + - name: Install webp |
| 34 | + run: sudo apt-get update -yq && sudo apt-get install webp |
| 35 | + - run: dart analyze --fatal-infos . |
| 36 | + working-directory: app/ |
| 37 | + - run: dart format --output=none --set-exit-if-changed . |
| 38 | + working-directory: app/ |
| 39 | + - run: dart test -P build-only -j 1 |
| 40 | + working-directory: app/ |
| 41 | + |
| 42 | + app_test: |
| 43 | + name: app/ (shard ${{matrix.shard}}) |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + shard: [0, 1, 2, 3, 4, 5, 6, 7] |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Cache PUB_CACHE |
| 51 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 |
| 52 | + with: |
| 53 | + path: ~/.pub-cache |
| 54 | + key: ${{runner.os}}-pub-cache |
| 55 | + - name: Setup Dart SDK |
| 56 | + uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c |
| 57 | + with: |
| 58 | + sdk: ${{env.DART_SDK_VERSION}} |
| 59 | + - name: Checkout repository |
| 60 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 61 | + - run: dart pub get |
| 62 | + - name: Install webp |
| 63 | + run: sudo apt-get update -yq && sudo apt-get install webp |
| 64 | + - run: dart test -P presubmit --shard-index ${{matrix.shard}} --total-shards 8 |
| 65 | + working-directory: app/ |
| 66 | + |
| 67 | + test_packages: |
| 68 | + strategy: |
| 69 | + fail-fast: false |
| 70 | + matrix: |
| 71 | + # TODO: use `dart pub workspace list --json` to get this list |
| 72 | + package: |
| 73 | + - api_builder |
| 74 | + - code_coverage |
| 75 | + - fake_gcloud |
| 76 | + - indexed_blob |
| 77 | + - pub_integration |
| 78 | + - pub_package_reader |
| 79 | + - _pub_shared |
| 80 | + - pub_worker |
| 81 | + - puppeteer_screenshots |
| 82 | + - web_app |
| 83 | + - web_css |
| 84 | + name: pkg/${{matrix.package}}/ |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - name: Cache PUB_CACHE |
| 88 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 |
| 89 | + with: |
| 90 | + path: ~/.pub-cache |
| 91 | + key: ${{runner.os}}-pub-cache |
| 92 | + - name: Setup Dart SDK |
| 93 | + uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c |
| 94 | + with: |
| 95 | + sdk: ${{env.DART_SDK_VERSION}} |
| 96 | + - name: Checkout repository |
| 97 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 98 | + - run: dart pub get |
| 99 | + - run: dart analyze --fatal-infos . |
| 100 | + working-directory: pkg/${{matrix.package}} |
| 101 | + - run: dart format --output=none --set-exit-if-changed . |
| 102 | + working-directory: pkg/${{matrix.package}} |
| 103 | + - name: Check for test directory |
| 104 | + id: check_test_dir |
| 105 | + run: | |
| 106 | + if [ -d "pkg/${{matrix.package}}/test" ]; then |
| 107 | + echo "Test directory found for ${{matrix.package}}." |
| 108 | + echo "exists=true" >> $GITHUB_OUTPUT |
| 109 | + else |
| 110 | + echo "No test directory found for ${{matrix.package}}. Skipping tests." |
| 111 | + echo "exists=false" >> $GITHUB_OUTPUT |
| 112 | + fi |
| 113 | + shell: bash |
| 114 | + - name: Run tests |
| 115 | + if: steps.check_test_dir.outputs.exists == 'true' |
| 116 | + run: | |
| 117 | + if [[ "${{ matrix.package }}" == "pub_integration" ]]; then |
| 118 | + dart tool/trigger_puppeteer_download.dart |
| 119 | + fi |
| 120 | + dart test --run-skipped |
| 121 | + working-directory: pkg/${{matrix.package}} |
0 commit comments