Skip to content

feat(code-coverage): refactor test workflows - part 8 #2

feat(code-coverage): refactor test workflows - part 8

feat(code-coverage): refactor test workflows - part 8 #2

on:
workflow_call:
inputs:
run:
type: boolean
default: true
schemas:
type: string
default: ''
backend_exclude:
type: string
default: ''
jobs:
test-sqlite:
if: ${{ inputs.run && !contains(inputs.backend_exclude, 'sqlite')}}
name: 🧪 Tests (${{ matrix.config.backend }})
uses: test: ./.github/workflows/code-coverage-and-test.yaml

Check failure on line 19 in .github/workflows/test-dispatcher.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/test-dispatcher.yaml

Invalid workflow file

You have an error in your yaml syntax on line 19
strategy:
fail-fast: false
matrix:
config:
- backend: SQLite - no schemas
args: 'list(dbname = file.path(tempdir(), "SQLite"))'
post_connect: ''
- backend: SQLite - w. schemas
args: 'list(dbname = file.path(tempdir(), "SQLite_schemas"))'
post_connect: >
list(paste0("ATTACH '", file.path(tempdir(), "SQLite_schemas_test"), "' AS 'test'"),
paste0("ATTACH '", file.path(tempdir(), "SQLite_schemas_test_one"), "' AS 'test.one'"))
env:
BACKEND: ${{ matrix.config.backend }}
BACKEND_DRV: RSQLite::SQLite
BACKEND_ARGS: ${{ matrix.config.args }}
BACKEND_POST_CONNECT: ${{ matrix.config.post_connect }}
test-postgres:
name: 🧪 Tests (postgres)
if: ${{ inputs.run && !contains(inputs.backend_exclude, 'postgres')}}
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 5
env:
BACKEND: PostgreSQL
BACKEND_DRV: RPostgres::Postgres
BACKEND_ARGS: ''
PGHOST: localhost
PGPORT: 5432
PGDATABASE: test
PGUSER: postgres
PGPASSWORD: postgres
steps:
- name: Setup testing schemata in PostgreSQL
if: ${{ inputs.schemas != 'none' }}
run: |
set -o xtrace
IFS=',' read -ra schemas <<< "${{ inputs.schemas }}"
for schema in "${schemas[@]}"; do
psql test -c "CREATE SCHEMA \"$schema\";"
done
- uses: ssi-dk/AEF-DDF/.github/workflows/code-coverage-and-test.yaml@feature/mssql_code_coverage
test-mssql:
name: 🧪 Tests (SQL Server 2019)
if: ${{ inputs.run && !contains(inputs.backend_exclude, 'mssql')}}
env:
BACKEND: MSSQL
BACKEND_DRV: odbc::odbc
BACKEND_ARGS: ''
CONN_ARGS_JSON: '{"MSSQL": {"driver": "SQL Server", "server": "localhost", "database": "TestDB", "trusted_connection": "true"}}'
steps:
- name: Install a SQL Server suite of tools
uses: potatoqualitee/[email protected]
with:
install: sqlengine, sqlpackage
- name: Configure database
run: |
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "CREATE DATABASE TestDB;"
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "GO"
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "USE TestDB;"
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "GO"
- name: Setup testing schemata in SQL server
if: ${{ inputs.schemas != 'none' }}
run: |
set -o xtrace
IFS=',' read -ra schemas <<< "${{ inputs.schemas }}"
for schema in "${schemas[@]}"; do
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "CREATE SCHEMA [$schema];"
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "GO"
done
- uses: ssi-dk/AEF-DDF/.github/workflows/code-coverage-and-test.yaml@feature/mssql_code_coverage