2020-11-20 09:01:18 -08:00
|
|
|
name: CI
|
|
|
|
|
2020-11-25 08:57:36 -08:00
|
|
|
on: [push, pull_request]
|
2020-11-20 09:01:18 -08:00
|
|
|
|
|
|
|
env:
|
|
|
|
PUB_ENVIRONMENT: bot.github
|
|
|
|
|
|
|
|
jobs:
|
2023-03-11 14:35:52 -08:00
|
|
|
setup:
|
|
|
|
uses: ./.github/workflows/setup.yml
|
2022-09-15 16:14:51 -07:00
|
|
|
|
2022-08-15 12:16:38 -07:00
|
|
|
docs:
|
2022-09-15 16:14:51 -07:00
|
|
|
name: "Documentation"
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2022-08-15 12:16:38 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: docs
|
|
|
|
|
|
|
|
steps:
|
2022-09-15 16:14:51 -07:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: ./.github/actions/prepare
|
2022-08-15 12:16:38 -07:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
|
|
|
- run: melos bootstrap --scope drift_docs,drift
|
2022-09-15 14:42:20 -07:00
|
|
|
working-directory: .
|
2022-09-15 16:14:51 -07:00
|
|
|
- name: Run build
|
|
|
|
env:
|
|
|
|
IS_RELEASE: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/latest-release' }}
|
|
|
|
run: dart run tool/ci_build.dart
|
|
|
|
- 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
|
2022-08-15 12:16:38 -07:00
|
|
|
- run: dart test
|
|
|
|
|
2022-09-15 16:14:51 -07:00
|
|
|
- name: Deploy to netlify (Branch)
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
2023-03-11 14:35:52 -08:00
|
|
|
uses: nwtgck/actions-netlify@v2
|
2022-09-15 16:14:51 -07:00
|
|
|
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' }}
|
2023-03-11 14:35:52 -08:00
|
|
|
uses: nwtgck/actions-netlify@v2
|
2022-09-15 16:14:51 -07:00
|
|
|
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 }}
|
|
|
|
|
2022-01-18 13:35:49 -08:00
|
|
|
drift:
|
2021-10-10 13:01:59 -07:00
|
|
|
name: "drift package"
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2022-08-15 12:16:38 -07:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-25 05:24:48 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
2021-10-10 13:01:59 -07:00
|
|
|
working-directory: drift
|
2020-11-20 09:01:18 -08:00
|
|
|
steps:
|
|
|
|
# setup
|
2022-09-15 16:14:51 -07:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: ./.github/actions/prepare
|
2022-09-15 16:14:51 -07:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
|
|
|
- run: melos bootstrap --scope drift
|
2022-09-15 14:42:20 -07:00
|
|
|
working-directory: .
|
2022-08-14 08:33:10 -07:00
|
|
|
- name: Get dependencies for plugin
|
|
|
|
run: |
|
2022-08-14 08:37:18 -07:00
|
|
|
echo "dependency_overrides:" >> pubspec_overrides.yaml
|
|
|
|
echo " drift: {path: ../../}" >> pubspec_overrides.yaml
|
|
|
|
echo " drift_dev: {path: ../../../drift_dev}" >> pubspec_overrides.yaml
|
|
|
|
echo " sqlparser: {path: ../../../sqlparser}" >> pubspec_overrides.yaml
|
2022-08-14 08:33:10 -07:00
|
|
|
dart pub get
|
2022-08-14 02:28:23 -07:00
|
|
|
working-directory: drift/tools/analyzer_plugin
|
2020-11-20 09:01:18 -08:00
|
|
|
# analysis
|
2021-05-25 05:24:48 -07:00
|
|
|
- run: dart format -o none --set-exit-if-changed .
|
2020-11-20 09:01:18 -08:00
|
|
|
name: dartfmt
|
|
|
|
- run: dart analyze --fatal-infos --fatal-warnings
|
|
|
|
# build, test and upload coverage
|
2020-11-20 09:25:53 -08:00
|
|
|
- run: dart run build_runner build --delete-conflicting-outputs
|
2022-01-18 13:35:49 -08:00
|
|
|
- run: dart test --preset ci_unit_tests #-x background_isolate --coverage=coverage
|
2020-11-20 11:30:21 -08:00
|
|
|
# - uses: actions/upload-artifact@v2
|
|
|
|
# with:
|
|
|
|
# name: moor-coverage-data
|
|
|
|
# path: |
|
|
|
|
# moor/coverage/
|
|
|
|
# moor/.dart_tool/package_config.json
|
|
|
|
# retention-days: 1
|
2020-11-20 09:01:18 -08:00
|
|
|
|
2021-10-10 13:01:59 -07:00
|
|
|
drift_dev:
|
2022-08-15 12:16:38 -07:00
|
|
|
runs-on: ubuntu-latest
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2023-03-23 10:10:19 -07:00
|
|
|
timeout-minutes: 15
|
2021-05-25 05:24:48 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
2021-10-10 13:01:59 -07:00
|
|
|
working-directory: drift_dev
|
2020-11-20 09:01:18 -08:00
|
|
|
steps:
|
|
|
|
# setup
|
2022-09-15 16:14:51 -07:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: ./.github/actions/prepare
|
2022-09-15 16:14:51 -07:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
|
|
|
- run: melos bootstrap --scope drift_dev
|
2022-09-15 14:42:20 -07:00
|
|
|
working-directory: .
|
2020-11-20 09:01:18 -08:00
|
|
|
# analysis
|
2021-05-25 05:24:48 -07:00
|
|
|
- run: dart format -o none --set-exit-if-changed .
|
2020-11-20 09:01:18 -08:00
|
|
|
name: dartfmt
|
|
|
|
- run: dart analyze --fatal-infos --fatal-warnings
|
2022-01-18 13:35:49 -08:00
|
|
|
- run: dart test
|
2021-11-28 11:47:39 -08:00
|
|
|
name: test
|
2020-11-20 09:01:18 -08:00
|
|
|
|
|
|
|
sqlparser:
|
2022-08-15 12:16:38 -07:00
|
|
|
runs-on: ubuntu-latest
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2021-05-25 05:24:48 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: sqlparser
|
2020-11-20 09:01:18 -08:00
|
|
|
steps:
|
|
|
|
# setup
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: ./.github/actions/prepare
|
2022-09-15 16:14:51 -07:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
2020-11-20 09:01:18 -08:00
|
|
|
- run: dart pub upgrade
|
|
|
|
# analysis
|
2021-05-25 05:24:48 -07:00
|
|
|
- run: dart format -o none --set-exit-if-changed .
|
2020-11-20 09:01:18 -08:00
|
|
|
name: dartfmt
|
|
|
|
- run: dart analyze --fatal-infos --fatal-warnings
|
|
|
|
# tests and coverage
|
2020-11-20 11:30:21 -08:00
|
|
|
- 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
|
2020-11-20 09:01:18 -08:00
|
|
|
|
|
|
|
misc_integration_tests:
|
|
|
|
name: "Integration tests"
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2022-08-15 12:16:38 -07:00
|
|
|
runs-on: ubuntu-latest
|
2021-11-11 05:40:41 -08:00
|
|
|
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
|
2023-07-24 12:44:43 -07:00
|
|
|
mariadb:
|
|
|
|
image: mariadb
|
|
|
|
env:
|
|
|
|
MARIADB_ROOT_PASSWORD: password
|
|
|
|
MARIADB_DATABASE: database
|
|
|
|
ports:
|
|
|
|
- 3306:3306
|
2020-11-20 09:01:18 -08:00
|
|
|
steps:
|
2022-09-15 16:14:51 -07:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: ./.github/actions/prepare
|
2022-09-15 16:14:51 -07:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
|
|
|
- run: melos bootstrap --no-flutter
|
2022-09-15 14:42:20 -07:00
|
|
|
working-directory: .
|
2023-08-02 08:41:50 -07:00
|
|
|
- name: Postgres integration tests
|
|
|
|
working-directory: extras/drift_postgres
|
|
|
|
run: |
|
|
|
|
dart pub upgrade
|
|
|
|
dart test
|
|
|
|
- name: MariaDB integration tests
|
|
|
|
working-directory: extras/drift_mariadb
|
|
|
|
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
|
2020-11-20 09:01:18 -08:00
|
|
|
|
2022-11-28 12:59:17 -08:00
|
|
|
migration_integration_tests:
|
|
|
|
name: "Integration tests for migration tooling"
|
2023-03-11 14:35:52 -08:00
|
|
|
needs: [setup]
|
2022-11-28 12:59:17 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-03-11 14:35:52 -08:00
|
|
|
- uses: ./.github/actions/prepare
|
2022-11-28 12:59:17 -08:00
|
|
|
with:
|
2023-03-11 14:35:52 -08:00
|
|
|
dart_version: ${{ needs.setup.outputs.dart_version }}
|
|
|
|
- run: melos bootstrap --scope migrations_example
|
2022-11-28 12:59:17 -08:00
|
|
|
working-directory: .
|
|
|
|
- name: Run build
|
2022-11-28 13:07:25 -08:00
|
|
|
working-directory: examples/migrations_example
|
2022-11-28 12:59:17 -08:00
|
|
|
run: |
|
2022-11-28 13:13:07 -08:00
|
|
|
dart run build_runner build --delete-conflicting-outputs
|
2022-11-28 12:59:17 -08:00
|
|
|
dart run drift_dev schema generate drift_migrations/ test/generated/ --data-classes --companions
|
|
|
|
dart run drift_dev schema generate drift_migrations/ lib/src/generated
|
|
|
|
- name: Test
|
2022-11-28 13:07:25 -08:00
|
|
|
working-directory: examples/migrations_example
|
2022-11-28 12:59:17 -08:00
|
|
|
run: dart test
|
|
|
|
- name: Check that extracting schema still works
|
2022-11-28 13:07:25 -08:00
|
|
|
working-directory: examples/migrations_example
|
2022-11-28 12:59:17 -08:00
|
|
|
run: dart run drift_dev schema dump lib/database.dart drift_migrations/
|
|
|
|
|
2020-11-20 11:30:21 -08:00
|
|
|
# upload_coverage:
|
|
|
|
# runs-on: ubuntu-20.04
|
|
|
|
# needs: [moor, sqlparser]
|
|
|
|
# steps:
|
|
|
|
# - uses: actions/checkout@v2
|
2021-11-14 03:20:42 -08:00
|
|
|
# - uses: dart-lang/setup-dart@v1
|
2020-11-20 11:30:21 -08:00
|
|
|
# - run: dart pub upgrade
|
|
|
|
# name: "Setup coverage processor"
|
2020-12-10 06:19:02 -08:00
|
|
|
# working-directory: extras/tooling
|
2020-11-20 11:30:21 -08:00
|
|
|
# - uses: actions/download-artifact@v2
|
|
|
|
# with:
|
|
|
|
# name: moor-coverage-data
|
|
|
|
# path: moor/
|
|
|
|
# - uses: actions/download-artifact@v2
|
|
|
|
# with:
|
|
|
|
# name: sqlparser-coverage-data
|
|
|
|
# path: sqlparser/
|
2020-12-10 06:19:02 -08:00
|
|
|
# - run: dart run extras/tooling/bin/coverage.dart
|
2020-11-20 11:30:21 -08:00
|
|
|
# name: "Format coverage from raw data"
|
|
|
|
# - uses: codecov/codecov-action@v1
|
|
|
|
# with:
|
2020-11-25 08:57:36 -08:00
|
|
|
# file: lcov.info
|