mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
test: Add GitHub Actions for tests CI/CD (#11157)
This commit is contained in:
parent
fdbb013d22
commit
d106eed439
170
.github/workflows/test.yml
vendored
Normal file
170
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
||||
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs
|
||||
# https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/creating-postgresql-service-containers
|
||||
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
cockroachdb:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: [18.x] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{matrix.node-version}}
|
||||
- uses: actions/checkout@v4
|
||||
- run: docker compose -f .github/workflows/test/cockroachdb.docker-compose up -d
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/cockroachdb.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
mongodb:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
container: ${{ matrix.node-container }}
|
||||
services:
|
||||
mongodb:
|
||||
image: mongo:5.0.12
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/mongodb.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
mssql:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
container: ${{ matrix.node-container }}
|
||||
services:
|
||||
mssql:
|
||||
image: "mcr.microsoft.com/mssql/server:2022-latest"
|
||||
env:
|
||||
SA_PASSWORD: "Admin12345"
|
||||
ACCEPT_EULA: "Y"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/mssql.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
mysql_mariadb:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
container: ${{ matrix.node-container }}
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7.37
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: "admin"
|
||||
MYSQL_USER: "test"
|
||||
MYSQL_PASSWORD: "test"
|
||||
MYSQL_DATABASE: "test"
|
||||
mariadb:
|
||||
image: mariadb:10.10.3
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: "admin"
|
||||
MYSQL_USER: "test"
|
||||
MYSQL_PASSWORD: "test"
|
||||
MYSQL_DATABASE: "test"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/mysql-mariadb.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
oracle:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: [18.x] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{matrix.node-version}}
|
||||
- uses: actions/checkout@v4
|
||||
- run: docker compose -f .github/workflows/test/oracle.docker-compose up -d
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/oracle.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
sqlite_better-sqlite3_sqljs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
container: ${{ matrix.node-container }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
|
||||
|
||||
posgres:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-container: ["node:18"] #["node:16", "node:18", "node:20", "node:22"]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
container: ${{ matrix.node-container }}
|
||||
services:
|
||||
postgres:
|
||||
image: postgis/postgis:14-3.3
|
||||
env:
|
||||
POSTGRES_USERNAME: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm i
|
||||
- run: cp .github/workflows/test/postgres.ormconfig.json ormconfig.json
|
||||
- run: npm test
|
||||
8
.github/workflows/test/cockroachdb.docker-compose
vendored
Normal file
8
.github/workflows/test/cockroachdb.docker-compose
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
version: "3"
|
||||
services:
|
||||
cockroachdb:
|
||||
image: "cockroachdb/cockroach:v23.1.9"
|
||||
container_name: "typeorm-cockroachdb"
|
||||
command: start-single-node --insecure --cache=0.75 --store=type=mem,size=0.75
|
||||
ports:
|
||||
- "26257:26257"
|
||||
24
.github/workflows/test/cockroachdb.ormconfig.json
vendored
Normal file
24
.github/workflows/test/cockroachdb.ormconfig.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "cockroachdb",
|
||||
"type": "cockroachdb",
|
||||
"host": "localhost",
|
||||
"port": 26257,
|
||||
"username": "root",
|
||||
"password": "",
|
||||
"database": "defaultdb"
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
26
.github/workflows/test/mongodb.ormconfig.json
vendored
Normal file
26
.github/workflows/test/mongodb.ormconfig.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"disabledIfNotEnabledImplicitly": true,
|
||||
"name": "mongodb",
|
||||
"type": "mongodb",
|
||||
"host": "mongodb",
|
||||
"port": 27017,
|
||||
"database": "test",
|
||||
"logging": false,
|
||||
"useNewUrlParser": true,
|
||||
"useUnifiedTopology": true
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
28
.github/workflows/test/mssql.ormconfig.json
vendored
Normal file
28
.github/workflows/test/mssql.ormconfig.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "mssql",
|
||||
"type": "mssql",
|
||||
"host": "mssql",
|
||||
"port": 1433,
|
||||
"username": "sa",
|
||||
"password": "Admin12345",
|
||||
"database": "tempdb",
|
||||
"logging": false,
|
||||
"extra": {
|
||||
"trustServerCertificate": true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
36
.github/workflows/test/mysql-mariadb.ormconfig.json
vendored
Normal file
36
.github/workflows/test/mysql-mariadb.ormconfig.json
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "mysql",
|
||||
"type": "mysql",
|
||||
"host": "mysql",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": "admin",
|
||||
"database": "test",
|
||||
"logging": false
|
||||
},
|
||||
{
|
||||
"skip": false,
|
||||
"name": "mariadb",
|
||||
"type": "mariadb",
|
||||
"host": "mariadb",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": "admin",
|
||||
"database": "test",
|
||||
"logging": false
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
13
.github/workflows/test/oracle.docker-compose
vendored
Normal file
13
.github/workflows/test/oracle.docker-compose
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
services:
|
||||
oracle:
|
||||
build:
|
||||
context: ../../../docker/oracle
|
||||
container_name: "typeorm-oracle"
|
||||
ports:
|
||||
- "1521:1521"
|
||||
#volumes:
|
||||
# - oracle-data:/opt/oracle/oradata
|
||||
healthcheck:
|
||||
test: [ "CMD", "/opt/oracle/checkDBStatus.sh" ]
|
||||
interval: 2s
|
||||
28
.github/workflows/test/oracle.ormconfig.json
vendored
Normal file
28
.github/workflows/test/oracle.ormconfig.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "oracle",
|
||||
"type": "oracle",
|
||||
"host": "localhost",
|
||||
"port": 1521,
|
||||
"serviceName": "XEPDB1",
|
||||
"username": "typeorm",
|
||||
"password": "oracle",
|
||||
"logging": false,
|
||||
"extra": {
|
||||
"connectString": "localhost:1521/XEPDB1"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
13
.github/workflows/test/postgres.ormconfig.json
vendored
Normal file
13
.github/workflows/test/postgres.ormconfig.json
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
35
.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json
vendored
Normal file
35
.github/workflows/test/sqlite-better-sqlite3-sqljs.ormconfig.json
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
[
|
||||
{
|
||||
"skip": false,
|
||||
"name": "sqljs",
|
||||
"type": "sqljs",
|
||||
"logging": false
|
||||
},
|
||||
{
|
||||
"skip": false,
|
||||
"name": "sqlite",
|
||||
"type": "sqlite",
|
||||
"database": "./temp/sqlitedb-1.db",
|
||||
"logging": false,
|
||||
"relationLoadStrategy": "join"
|
||||
},
|
||||
{
|
||||
"skip": false,
|
||||
"name": "better-sqlite3",
|
||||
"type": "better-sqlite3",
|
||||
"database": "temp/better-sqlite3db.db",
|
||||
"logging": false
|
||||
},
|
||||
|
||||
{
|
||||
"skip": true,
|
||||
"name": "postgres",
|
||||
"type": "postgres",
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"username": "postgres",
|
||||
"password": "postgres",
|
||||
"database": "postgres",
|
||||
"logging": false
|
||||
}
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user