Add changelog entry for dart2wasm fix #3004
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- "**" # we just don't want this to run redundantly on tags | |
pull_request: | |
env: | |
PUB_ENVIRONMENT: bot.github | |
jobs: | |
setup: | |
uses: ./.github/workflows/setup.yml | |
docs: | |
name: "Documentation" | |
needs: [setup] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: docs | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: 3.24 | |
cache: true | |
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" | |
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" | |
- name: Bootstrap Dart packages | |
run: melos bootstrap --scope drift_docs,drift,app | |
working-directory: . | |
- name: Run build | |
env: | |
IS_RELEASE: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/latest-release' }} | |
run: | | |
chmod +x ./docs.sh | |
./docs.sh build | |
- name: Analyze Dart and Drift sources | |
run: | | |
dart format -o none --set-exit-if-changed . | |
dart analyze --fatal-infos --fatal-warnings | |
dart run drift_dev analyze | |
- name: Test Dart and Drift sources | |
run: dart test | |
- name: Deploy to netlify (Branch) | |
if: ${{ github.event_name == 'push' }} | |
uses: nwtgck/actions-netlify@v3 | |
with: | |
production-branch: latest-release | |
publish-dir: docs/deploy | |
enable-pull-request-comment: true | |
enable-commit-comment: false | |
netlify-config-path: "./netlify.toml" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
- name: Deploy to netlify (Pull Request) | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: nwtgck/actions-netlify@v3 | |
with: | |
production-branch: latest-release | |
publish-dir: docs/deploy | |
enable-pull-request-comment: true | |
enable-commit-comment: false | |
netlify-config-path: "./netlify.toml" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
alias: deploy-preview-${{ github.event.number }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
drift: | |
name: "drift package" | |
needs: [setup] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: drift | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --scope drift | |
working-directory: . | |
# analysis | |
- run: dart format -o none --set-exit-if-changed . | |
name: dartfmt | |
- run: dart analyze --fatal-infos --fatal-warnings | |
# build, test and upload coverage | |
- run: dart run build_runner build --delete-conflicting-outputs | |
- run: dart run build_runner doctor | |
- run: dart test --preset ci_unit_tests #-x background_isolate --coverage=coverage | |
env: | |
DID_RUN_BUILD_RUNNER: "1" | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: moor-coverage-data | |
# path: | | |
# moor/coverage/ | |
# moor/.dart_tool/package_config.json | |
# retention-days: 1 | |
drift_web_ddc: | |
needs: [drift] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: drift | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --scope drift | |
working-directory: . | |
# Using build_runner test allows compiling the tests with ddc, which is much faster than | |
# dart2js since we have a lot of entrypoints. | |
- run: dart run tool/test_with_ddc.dart | |
# todo: Even with shards, dart2js take too long. We run unit tests with ddc and dart2wasm and | |
# also run web integration tests (compiled with dart2js), so maybe we don't need those? | |
# drift_web_dart2js: | |
# needs: [drift] | |
# runs-on: ubuntu-latest | |
# defaults: | |
# run: | |
# working-directory: drift | |
# strategy: | |
# matrix: | |
# browser: [chrome, firefox] | |
# shard: [0, 1, 2, 3] | |
# name: "Drift web unit tests, dart2js, ${{ matrix.browser }}, shard ${{ matrix.shard }}" | |
# steps: | |
# # setup | |
# - uses: actions/checkout@v4 | |
# - uses: ./.github/actions/prepare | |
# with: | |
# dart_version: ${{ needs.setup.outputs.dart_version }} | |
# - run: melos bootstrap --scope drift | |
# working-directory: . | |
# - run: dart test -p ${{ matrix.browser }} --compiler dart2js --total-shards 4 --shard-index ${{ matrix.shard }} | |
drift_web_dart2wasm: | |
needs: [drift] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: drift | |
strategy: | |
matrix: | |
browser: [chrome, firefox] | |
name: "Drift web unit tests, dart2wasm, ${{ matrix.browser }}" | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --scope drift | |
working-directory: . | |
- run: dart test -p ${{ matrix.browser }} --compiler dart2wasm | |
drift_dev: | |
runs-on: ubuntu-latest | |
needs: [setup] | |
timeout-minutes: 15 | |
defaults: | |
run: | |
working-directory: drift_dev | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --scope drift_dev --scope drift | |
working-directory: . | |
# analysis | |
- run: dart format -o none --set-exit-if-changed . | |
name: dartfmt | |
- run: dart analyze --fatal-infos --fatal-warnings | |
- run: dart test | |
name: test | |
sqlparser: | |
runs-on: ubuntu-latest | |
needs: [setup] | |
defaults: | |
run: | |
working-directory: sqlparser | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: dart pub upgrade | |
# analysis | |
- run: dart format -o none --set-exit-if-changed . | |
name: dartfmt | |
- run: dart analyze --fatal-infos --fatal-warnings | |
# tests and coverage | |
- run: dart test #--coverage=coverage | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: sqlparser-coverage-data | |
# path: | | |
# sqlparser/coverage/ | |
# sqlparser/.dart_tool/package_config.json | |
# retention-days: 1 | |
misc_integration_tests: | |
name: "Integration tests" | |
needs: [setup] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
mariadb: | |
image: mariadb | |
env: | |
MARIADB_ROOT_PASSWORD: password | |
MARIADB_DATABASE: database | |
ports: | |
- 3306:3306 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --no-flutter | |
working-directory: . | |
- name: Postgres integration tests | |
working-directory: extras/drift_postgres | |
run: | | |
dart pub upgrade | |
dart test -j 1 | |
- name: MariaDB integration tests | |
working-directory: extras/drift_mariadb | |
continue-on-error: true | |
run: | | |
dart pub upgrade | |
dart test | |
- name: Integration test with built_value | |
working-directory: examples/with_built_value | |
run: | | |
dart pub upgrade | |
dart run build_runner build --delete-conflicting-outputs | |
- name: Integration test with modular generation | |
working-directory: examples/modular | |
run: | | |
dart pub upgrade | |
dart run build_runner build --delete-conflicting-outputs | |
dart run bin/example.dart | |
- name: Integration test for migrations example | |
working-directory: examples/migrations_example | |
run: | | |
dart pub upgrade | |
dart test | |
test_flutter: | |
runs-on: ubuntu-latest | |
needs: [setup] | |
strategy: | |
matrix: | |
# We want to support the two latest stable Flutter versions | |
# Unfortunately, we currently can't support Flutter 3.22 because it's | |
# incompatible with `dart_style: ^2.3.7` that `drift_dev` has to use: | |
# https://github.com/simolus3/drift/issues/3302 | |
flutter: ["3.24"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ matrix.flutter }} | |
cache: true | |
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" | |
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" | |
- name: Setup melos | |
run: dart pub global activate melos && dart pub get | |
shell: bash | |
- name: Install dependencies in drift/example/app | |
run: melos bootstrap --scope app | |
- name: Download sqlite3 | |
uses: actions/download-artifact@v4 | |
with: | |
name: sqlite3 | |
path: drift/.dart_tool/sqlite3/ | |
- name: Use downloaded sqlite3 | |
shell: bash | |
run: | | |
chmod a+x drift/.dart_tool/sqlite3/latest/sqlite3 | |
echo $(realpath drift/.dart_tool/sqlite3/latest) >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=$(realpath drift/.dart_tool/sqlite3/latest)" >> $GITHUB_ENV | |
- name: Check sqlite3 version | |
run: sqlite3 --version | |
shell: bash | |
- name: Generate code | |
run: dart run build_runner build --delete-conflicting-outputs | |
working-directory: examples/app | |
- name: Test CLI | |
run: | | |
dart run drift_dev schema dump lib/database/database.dart drift_schemas/ | |
dart run drift_dev schema generate drift_schemas/ test/generated_migrations/ | |
dart run drift_dev schema steps drift_schemas/ lib/database/schema_versions.dart | |
working-directory: examples/app | |
- run: flutter analyze | |
working-directory: examples/app | |
- run: flutter test | |
working-directory: examples/app | |
migration_integration_tests: | |
name: "Integration tests for migration tooling" | |
needs: [setup] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- run: melos bootstrap --scope migrations_example | |
working-directory: . | |
- name: Run build | |
working-directory: examples/migrations_example | |
run: | | |
dart run build_runner build --delete-conflicting-outputs | |
dart run drift_dev schema generate drift_schemas/default test/generated/ --data-classes --companions | |
dart run drift_dev schema generate drift_schemas/ lib | |
- name: Test | |
working-directory: examples/migrations_example | |
run: dart test | |
- name: Test with older sqlite3 | |
working-directory: examples/migrations_example | |
run: | | |
LD_LIBRARY_PATH=$(realpath ../../drift/.dart_tool/sqlite3/minimum) dart test | |
- name: Check that extracting schema still works | |
working-directory: examples/migrations_example | |
run: dart run drift_dev schema dump lib/database.dart drift_migrations/ | |
web_integration_tests: | |
name: "Web integration tests" | |
needs: [drift] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/prepare | |
with: | |
dart_version: ${{ needs.setup.outputs.dart_version }} | |
- uses: nanasess/setup-chromedriver@v2 | |
- run: melos bootstrap --scope web_wasm | |
working-directory: . | |
- name: Test | |
working-directory: extras/integration_tests/web_wasm | |
run: dart test | |
# upload_coverage: | |
# runs-on: ubuntu-20.04 | |
# needs: [moor, sqlparser] | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - uses: dart-lang/setup-dart@v1 | |
# - run: dart pub upgrade | |
# name: "Setup coverage processor" | |
# working-directory: extras/tooling | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# name: moor-coverage-data | |
# path: moor/ | |
# - uses: actions/download-artifact@v2 | |
# with: | |
# name: sqlparser-coverage-data | |
# path: sqlparser/ | |
# - run: dart run extras/tooling/bin/coverage.dart | |
# name: "Format coverage from raw data" | |
# - uses: codecov/codecov-action@v1 | |
# with: | |
# file: lcov.info |