不要怂,就是干,撸起袖子干!

Commit 2a79df36 by Pedro Augusto de Paula Barbosa Committed by GitHub

test: begin transition to GitHub Actions (#12887)

1 parent 0eb93af6
name: CI
on: [push, pull_request]
env:
SEQ_DB: sequelize_test
SEQ_USER: sequelize_test
SEQ_PW: sequelize_test
jobs:
lint:
name: Lint code and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: npm run lint
- run: npm run lint-docs
test-typings:
name: TS Typings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: npm run test-typings
test-sqlite:
name: SQLite
runs-on: ubuntu-latest
env:
DIALECT: sqlite
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- name: Unit Tests
run: npm run test-unit
- name: Integration Tests
run: npm run test-integration
test-postgres:
strategy:
fail-fast: false
matrix:
postgres-version: [9.5, 10] # Does not work with 12
native: [true, false]
name: Postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }}
runs-on: ubuntu-latest
services:
postgres:
image: sushantdhiman/postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: sequelize_test
POSTGRES_DB: sequelize_test
POSTGRES_PASSWORD: sequelize_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }}
steps:
- run: PGPASSWORD=sequelize_test psql -h localhost -p 5432 -U sequelize_test sequelize_test -c '\l'
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: npm install pg-native
if: matrix.native
- name: Unit Tests
run: npm run test-unit
- name: Integration Tests
run: npm run test-integration
test-mysql-mariadb:
strategy:
fail-fast: false
matrix:
include:
- name: MySQL 5.7
image: mysql:5.7
dialect: mysql
- name: MariaDB 10.3
image: mariadb:10.3
dialect: mariadb
name: ${{ matrix.name }}
runs-on: ubuntu-latest
services:
mysql:
image: ${{ matrix.image }}
env:
MYSQL_DATABASE: sequelize_test
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
MYSQL_ROOT_PASSWORD: sequelize_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin -usequelize_test -psequelize_test status" --health-interval 10s --health-timeout 5s --health-retries 5 --tmpfs /var/lib/mysql:rw
env:
DIALECT: ${{ matrix.dialect }}
steps:
- run: mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;"
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- name: Unit Tests
run: npm run test-unit
- name: Integration Tests
run: npm run test-integration
test-mssql:
strategy:
fail-fast: false
matrix:
mssql-version: [2017, 2019]
name: MSSQL ${{ matrix.mssql-version }}
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:${{ matrix.mssql-version }}-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Password12!
ports:
- 1433:1433
options: >-
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -l 30 -Q \"SELECT 1\" || exit 1"
--health-start-period 10s
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
DIALECT: mssql
steps:
- run: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE sequelize_test; ALTER DATABASE sequelize_test SET READ_COMMITTED_SNAPSHOT ON;"
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- name: Unit Tests
run: npm run test-unit
- name: Integration Tests
run: npm run test-integration
{
"host": "localhost",
"username": "SA",
"password": "Password12!",
"port": 1433,
"database": "sequelize_test",
"dialectOptions": {
"options": {
"encrypt": false,
"requestTimeout": 25000
}
},
"pool": {
"max": 5,
"idle": 3000
}
}
......@@ -20,8 +20,8 @@ describe(Support.getTestDialectTeaser('Configuration'), () => {
it('when we don\'t have the correct server details', async () => {
const options = {
logging: false,
host: '0.0.0.1',
port: config[dialect].port,
host: 'localhost',
port: 19999, // Wrong port
dialect
};
......@@ -47,8 +47,7 @@ describe(Support.getTestDialectTeaser('Configuration'), () => {
it('when we don\'t have the correct login information', async () => {
if (dialect === 'mssql') {
// NOTE: Travis seems to be having trouble with this test against the
// AWS instance. Works perfectly fine on a local setup.
// TODO: GitHub Actions seems to be having trouble with this test. Works perfectly fine on a local setup.
expect(true).to.be.true;
return;
}
......
......@@ -578,14 +578,21 @@ if (current.dialect.supports.transactions) {
const transaction = await this.sequelize.transaction({ isolationLevel: Transaction.ISOLATION_LEVELS.SERIALIZABLE });
await User.findAll( { transaction } );
await Promise.all([// Update should not succeed before transaction has committed
await Promise.all([
// Update should not succeed before transaction has committed
User.update({ username: 'joe' }, {
where: {
username: 'jan'
}
}).then(() => expect(transactionSpy).to.have.been.called ), delay(2000)
}).then(() => {
expect(transactionSpy).to.have.been.called;
expect(transaction.finished).to.equal('commit');
}),
delay(4000)
.then(transactionSpy)
.then(() => transaction.commit())
.then(transactionSpy)]);
]);
});
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!