Don't use BEGIN IMMEDIATE on the web #470
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| pull_request: | |
| jobs: | |
| analyze: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) | |
| outputs: | |
| dart-version: ${{ steps.dart.outputs.dart-version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dart-lang/setup-dart@v1 | |
| id: dart | |
| - name: "Setup local pub cache folder" | |
| # Make pub cache folder consistent across OSes, so that we can share the cache. | |
| run: "echo PUB_CACHE=.dart_tool/pub-cache/ >> $GITHUB_ENV" | |
| shell: bash | |
| # We need to update the cache whenever the pubspec.lock changes, as that | |
| # indicates a changed dependency after `pub upgrade`. However, we can't | |
| # include the pubspec.lock in the cache key as it's not part of the repository. | |
| # So, we explicitly restore from and update to the cache as needed. | |
| - uses: actions/cache/restore@v5 | |
| id: restore | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| pubspec.lock | |
| key: dart-deps-${{ steps.dart.outputs.dart-version }}-${{ hashFiles('pubspec.yaml') }} | |
| restore-keys: | |
| dart-deps-${{ steps.dart.outputs.dart-version }} | |
| dart-deps- | |
| enableCrossOsArchive: true | |
| - name: "Hash pubspec lockfiles before pub upgrade" | |
| id: deps-before | |
| run: | | |
| echo "lockfiles=${{ hashFiles('**/pubspec.lock') }}" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: "Install dependencies" | |
| run: | | |
| dart pub upgrade | |
| dart pub global activate pana | |
| - name: "Ensure formatted" | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: "Analyze project" | |
| run: dart analyze --fatal-infos | |
| - name: "Update cache due to changed pubspec.lock" | |
| if: ${{ hashFiles('**/pubspec.lock') != steps.deps-before.outputs.lockfiles || !steps.restore.outputs.cache-hit }} | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| pubspec.lock | |
| key: dart-deps-${{ steps.dart.outputs.dart-version }}-${{ hashFiles('pubspec.yaml') }} | |
| enableCrossOsArchive: true | |
| test: | |
| needs: [analyze] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ needs.analyze.outputs.dart-version }} | |
| - name: "Setup local pub cache folder" | |
| run: "echo PUB_CACHE=.dart_tool/pub-cache/ >> $GITHUB_ENV" | |
| shell: bash | |
| - uses: actions/cache/restore@v5 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| pubspec.lock | |
| key: dart-deps-${{ needs.analyze.outputs.dart-version }}-${{ hashFiles('pubspec.yaml') }} | |
| # Should be created by analyze run | |
| fail-on-cache-miss: true | |
| enableCrossOsArchive: true | |
| - name: "Get dependencies" | |
| run: | | |
| dart pub get | |
| dart pub global activate pana | |
| - name: Setup | |
| run: | | |
| dart run tool/sqlite3_wasm_download.dart | |
| dart compile js -O4 --no-minify -o assets/db_worker.js packages/sqlite_async/lib/src/web/worker/worker.dart | |
| - name: Test sqlite_async | |
| working-directory: packages/sqlite_async | |
| run: | | |
| dart test -p chrome,vm --compiler dart2js,dart2wasm | |
| dart run build_runner test -- -p chrome | |
| - name: Test drift_sqlite_async | |
| working-directory: packages/drift_sqlite_async | |
| run: dart test | |
| - name: Pana for sqlite_async | |
| run: dart pub global run pana --no-warning packages/sqlite_async | |
| # We don't run pana on drift_sqlite_async because it can depend on unpublished changes from | |
| # sqlite_async, causing it to fail all the time. |