drift/.github/workflows/main.yml

253 lines
7.8 KiB
YAML
Raw Normal View History

2020-11-20 09:01:18 -08:00
name: CI
2023-10-19 14:23:36 -07:00
on:
push:
branches:
- '**' # we just don't want this to run redundantly on tags
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-08-15 12:16:38 -07:00
docs:
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:
- 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: .
- 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
- name: Deploy to netlify (Branch)
if: ${{ github.event_name == 'push' }}
2023-03-11 14:35:52 -08:00
uses: nwtgck/actions-netlify@v2
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
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
defaults:
run:
2021-10-10 13:01:59 -07:00
working-directory: drift
2020-11-20 09:01:18 -08:00
steps:
# setup
- uses: actions/checkout@v3
2023-03-11 14:35:52 -08:00
- uses: ./.github/actions/prepare
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: .
2020-11-20 09:01:18 -08:00
# analysis
- 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]
timeout-minutes: 15
defaults:
run:
2021-10-10 13:01:59 -07:00
working-directory: drift_dev
2020-11-20 09:01:18 -08:00
steps:
# setup
- uses: actions/checkout@v3
2023-03-11 14:35:52 -08:00
- uses: ./.github/actions/prepare
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
- 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]
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
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
- 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
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:
- uses: actions/checkout@v3
2023-03-11 14:35:52 -08:00
- uses: ./.github/actions/prepare
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: .
- name: Postgres integration tests
working-directory: extras/drift_postgres
run: |
dart pub upgrade
2023-10-21 15:36:07 -07:00
dart test -j 1
- name: MariaDB integration tests
working-directory: extras/drift_mariadb
2023-08-02 09:27:52 -07:00
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
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
working-directory: examples/migrations_example
2022-11-28 12:59:17 -08:00
run: |
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
working-directory: examples/migrations_example
2022-11-28 12:59:17 -08:00
run: dart test
- name: Check that extracting schema still works
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:
# file: lcov.info