Scheduled #208
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: Scheduled | |
on: | |
schedule: | |
- cron: '24 8 * * 0,3,5' | |
jobs: | |
fmt: | |
strategy: | |
matrix: | |
version: [vx.x.x, canary] | |
name: Test format and lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Install deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: Check fmt | |
run: deno fmt --check | |
- name: Check lint | |
run: deno lint | |
unit: | |
strategy: | |
matrix: | |
version: [vx.x.x, canary] | |
name: Test unit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Install deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: Run unit tests | |
run: deno task test:unit | |
- name: Generate lcov | |
run: deno coverage --unstable --lcov ./coverage > coverage.lcov | |
- name: Upload coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
files: coverage.lcov | |
flags: unit | |
cli: | |
strategy: | |
matrix: | |
version: [vx.x.x, canary] | |
name: Test CLI | |
runs-on: ubuntu-latest | |
env: | |
URL_PATH: ${{github.repository}}/main | |
steps: | |
- name: Install deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: Nessie Init | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --dialect sqlite | |
- run: sed -i "s|from \".*\"|from \"https://raw.githubusercontent.com/$URL_PATH/mod.ts\"|" nessie.config.ts && cat nessie.config.ts | |
- name: Create migration | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make test | |
- name: Create migration | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:migration test2 | |
- name: Create seed | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:seed test | |
- run: echo "test" >> test_template | |
- name: Create migration from custom template | |
run: | | |
deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:migration --migrationTemplate test_template test_migration_template | |
TEMPLATE_PATH=$(find db/migrations -type f -name "*test_migration_template.ts") | |
TEMPLATE_CONTENT=$(cat $TEMPLATE_PATH) | |
if [[ $TEMPLATE_CONTENT != "test" ]]; then echo "File $TEMPLATE_PATH was not correct, was:\n$TEMPLATE_CONTENT" && exit 1; fi | |
- name: Create seed from custom template | |
run: | | |
deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:seed --seedTemplate test_template test_seed_template | |
TEMPLATE_PATH=$(find db/seeds -type f -name "test_seed_template.ts") | |
TEMPLATE_CONTENT=$(cat $TEMPLATE_PATH) | |
if [[ $TEMPLATE_CONTENT != "test" ]]; then echo "File $TEMPLATE_PATH was not correct, was:\n$TEMPLATE_CONTENT" && exit 1; fi | |
- name: Clean files and folders | |
run: rm -rf db && rm -rf nessie.config.ts | |
- name: Init with mode and pg | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect pg | |
- name: Init with mode and mysql | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect mysql | |
- name: Init with mode and sqlite | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect sqlite | |
- name: Init with folders only | |
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode folders | |
cli-migrations: | |
strategy: | |
matrix: | |
version: [vx.x.x, canary] | |
name: Test CLI Migrations | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: pwd | |
POSTGRES_DB: nessie | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5000:5432 | |
mysql: | |
image: mysql | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_DATABASE: nessie | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
ports: | |
- 5001:3306 | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Install deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: Create databases | |
run: make db_sqlite_start | |
- name: Run tests | |
run: make test_integration_cli | |
- name: Generate lcov | |
run: deno coverage --unstable --lcov ./coverage > coverage.lcov | |
- name: Upload coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
files: coverage.lcov | |
flags: integration-cli | |
image-test: | |
name: Test Docker image build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build image | |
run: make image_build | |
env: | |
DENO_VERSION: latest | |
- name: Test image | |
run: make image_test |