Setup ORM automated tests
This commit is contained in:
parent
339fc08e15
commit
ac91cde03d
3 changed files with 38 additions and 6 deletions
34
.github/workflows/dart.yml
vendored
34
.github/workflows/dart.yml
vendored
|
@ -12,7 +12,7 @@ on:
|
|||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
jobs_001:
|
||||
job_001:
|
||||
name: Validate framework package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -41,10 +41,29 @@ jobs:
|
|||
working-directory: packages/framework
|
||||
run: dart test
|
||||
|
||||
jobs_002:
|
||||
job_002:
|
||||
name: Validate ORM packages
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Service containers to run with `runner-job`
|
||||
services:
|
||||
# Label used to access the service container
|
||||
postgres:
|
||||
# Docker Hub image
|
||||
image: postgres
|
||||
# Provide the password for postgres
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# Set health checks to wait until postgres has started
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
# Maps tcp port 5432 on service container to the host
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -116,3 +135,14 @@ jobs:
|
|||
working-directory: packages/orm/angel_orm_postgres
|
||||
run: dart analyze .
|
||||
|
||||
- name: angel3_orm_postgres; Run tests
|
||||
working-directory: packages/orm/angel3_orm_postgres
|
||||
run: dart test
|
||||
env:
|
||||
# The hostname used to communicate with the PostgreSQL service container
|
||||
POSTGRES_HOST: localhost
|
||||
# The default PostgreSQL port
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USERNAME: postgres
|
||||
POSTGRES_DB: postgres
|
|
@ -7,7 +7,7 @@ void main() async {
|
|||
PgEndpoint(
|
||||
host: 'localhost',
|
||||
port: 5432,
|
||||
database: 'orm_test',
|
||||
database: Platform.environment['POSTGRES_DB'] ?? 'orm_test',
|
||||
username: Platform.environment['POSTGRES_USERNAME'] ?? 'test',
|
||||
password: Platform.environment['POSTGRES_PASSWORD'] ?? 'test123',
|
||||
),
|
||||
|
|
|
@ -27,7 +27,8 @@ Future<void> closePg(QueryExecutor executor) async {
|
|||
}
|
||||
|
||||
Future<PostgreSqlExecutor> connectToPostgres(Iterable<String> schemas) async {
|
||||
var conn = PostgreSQLConnection('127.0.0.1', 5432, 'orm_test',
|
||||
var conn = PostgreSQLConnection(
|
||||
'localhost', 5432, Platform.environment['POSTGRES_DB'] ?? 'orm_test',
|
||||
username: Platform.environment['POSTGRES_USERNAME'] ?? 'test',
|
||||
password: Platform.environment['POSTGRES_PASSWORD'] ?? 'test123');
|
||||
await conn.open();
|
||||
|
@ -43,7 +44,8 @@ Future<PostgreSqlExecutor> connectToPostgres(Iterable<String> schemas) async {
|
|||
Future<PostgreSqlExecutorPool> connectToPostgresPool1(
|
||||
Iterable<String> schemas) async {
|
||||
PostgreSQLConnection connectionFactory() {
|
||||
return PostgreSQLConnection('127.0.0.1', 5432, 'orm_test',
|
||||
return PostgreSQLConnection(
|
||||
'localhost', 5432, Platform.environment['POSTGRES_DB'] ?? 'orm_test',
|
||||
username: Platform.environment['POSTGRES_USERNAME'] ?? 'test',
|
||||
password: Platform.environment['POSTGRES_PASSWORD'] ?? 'test123');
|
||||
}
|
||||
|
@ -65,7 +67,7 @@ Future<PostgreSqlPoolExecutor> connectToPostgresPool(
|
|||
PgEndpoint(
|
||||
host: 'localhost',
|
||||
port: 5432,
|
||||
database: 'orm_test',
|
||||
database: Platform.environment['POSTGRES_DB'] ?? 'orm_test',
|
||||
username: Platform.environment['POSTGRES_USERNAME'] ?? 'test',
|
||||
password: Platform.environment['POSTGRES_PASSWORD'] ?? 'test123',
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue