drift/.github/workflows/main.yml

192 lines
5.4 KiB
YAML
Raw Normal View History

2020-11-20 09:01:18 -08:00
name: CI
on: [push, pull_request]
2020-11-20 09:01:18 -08:00
env:
PUB_ENVIRONMENT: bot.github
jobs:
2021-05-25 10:12:30 -07:00
# Compile the latest sqlite3 library, which will be used to run tests in moor
# and sqlparser
compile_sqlite3:
name: "Compile sqlite3 for tests"
runs-on: ubuntu-20.04
env:
SQLITE_VERSION: "3350500"
2021-11-14 03:20:42 -08:00
2021-05-25 10:12:30 -07:00
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: cache_build
with:
path: /tmp/sqlite/out/
key: ${{ runner.os }}-${{ env.SQLITE_VERSION }}
- name: Compile sqlite3
if: steps.cache_build.outputs.cache-hit != 'true'
run: |
cd /tmp/
mkdir sqlite
cd sqlite
curl https://sqlite.org/2021/sqlite-autoconf-$SQLITE_VERSION.tar.gz --output sqlite.tar.gz
tar zxvf sqlite.tar.gz
cd sqlite-autoconf-$SQLITE_VERSION
./configure
make
mkdir ../out
cp sqlite3 ../out
cp .libs/libsqlite3.so ../out
- name: Upload built sqlite3 binaries
uses: actions/upload-artifact@v2
with:
name: sqlite3
path: /tmp/sqlite/out/
if-no-files-found: error
retention-days: 1
2020-11-20 09:01:18 -08:00
moor:
2021-10-10 13:01:59 -07:00
name: "drift package"
2021-05-25 10:12:30 -07:00
needs: [compile_sqlite3]
runs-on: ubuntu-20.04
defaults:
run:
2021-10-10 13:01:59 -07:00
working-directory: drift
2020-11-20 09:01:18 -08:00
steps:
# setup
2020-11-20 09:03:42 -08:00
- uses: actions/checkout@v2
2021-11-14 03:20:42 -08:00
- uses: dart-lang/setup-dart@v1
2021-05-28 13:28:21 -07:00
- name: Download sqlite3
uses: actions/download-artifact@v2
with:
name: sqlite3
path: /tmp/sqlite/out/
- name: Use downloaded sqlite3
run: |
2021-05-28 13:28:21 -07:00
chmod a+x /tmp/sqlite/out/sqlite3
echo "/tmp/sqlite/out" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
- name: Check sqlite3 version
run: sqlite3 --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
# build, test and upload coverage
2020-11-20 09:25:53 -08:00
- run: dart run build_runner build --delete-conflicting-outputs
- run: dart test #-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:
runs-on: ubuntu-20.04
defaults:
run:
2021-10-10 13:01:59 -07:00
working-directory: drift_dev
2020-11-20 09:01:18 -08:00
steps:
# setup
2020-11-20 09:03:42 -08:00
- uses: actions/checkout@v2
2021-11-14 03:20:42 -08:00
- uses: dart-lang/setup-dart@v1
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
2021-11-28 11:47:39 -08:00
- run: dart test
name: test
2020-11-20 09:01:18 -08:00
sqlparser:
runs-on: ubuntu-20.04
2021-05-28 13:28:21 -07:00
needs: [compile_sqlite3]
defaults:
run:
working-directory: sqlparser
2020-11-20 09:01:18 -08:00
steps:
# setup
2020-11-20 09:03:42 -08:00
- uses: actions/checkout@v2
2021-11-14 03:20:42 -08:00
- uses: dart-lang/setup-dart@v1
2021-05-25 10:12:30 -07:00
- name: Download sqlite3
uses: actions/download-artifact@v2
with:
name: sqlite3
path: /tmp/sqlite/out/
- name: Use downloaded sqlite3
run: |
chmod a+x /tmp/sqlite/out/sqlite3
echo "/tmp/sqlite/out" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
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"
2021-05-25 10:12:30 -07:00
needs: [compile_sqlite3]
runs-on: ubuntu-20.04
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
2020-11-20 09:01:18 -08:00
steps:
2020-11-20 09:03:42 -08:00
- uses: actions/checkout@v2
2021-11-14 03:20:42 -08:00
- uses: dart-lang/setup-dart@v1
2020-11-20 09:14:39 -08:00
with:
release-channel: beta
2021-05-25 10:12:30 -07:00
- name: Download sqlite3
uses: actions/download-artifact@v2
with:
name: sqlite3
path: /tmp/sqlite/out/
- name: Use downloaded sqlite3
run: |
chmod a+x /tmp/sqlite/out/sqlite3
echo "/tmp/sqlite/out" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
2020-11-20 09:01:18 -08:00
- run: tool/misc_integration_test.sh
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