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

Commit f42d5f3a by papb

ci: move to GitHub Actions

1 parent 5fd55c3b
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: 10.x
- run: npm install
- run: npm run lint
- run: npm run lint-docs
test-typings:
strategy:
fail-fast: false
matrix:
ts-version: [3.9, 4.0, 4.1]
name: TS Typings (${{ matrix.ts-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
- run: npm install
- run: npm install --save-dev typescript@~${{ matrix.ts-version }}
- 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: 6.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
minify-aliases: [true, false]
native: [true, false]
name: Postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }}${{ matrix.minify-aliases && ' (minified aliases)' || '' }}
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' }}
SEQ_PG_MINIFY_ALIASES: ${{ matrix.minify-aliases && '1' || '' }}
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: 6.x
- run: npm install
- run: npm install pg-native
if: matrix.native
- name: Unit Tests
run: npm run test-unit
if: ${{ !matrix.minify-aliases }}
- 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: 6.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: 6.x
- run: npm install
- name: Unit Tests
run: npm run test-unit
- name: Integration Tests
run: npm run test-integration
release:
name: Release
runs-on: ubuntu-latest
needs: [lint, test-typings, test-sqlite, test-postgres, test-mysql-mariadb, test-mssql]
if: github.event_name == 'push' && github.ref == 'refs/heads/v5'
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
# - run: npm run semantic-release
- run: echo 'Release would happen here!'
sudo: true
dist: trusty
language: node_js
branches:
only:
- master
- v5
except:
- /^v\d+\.\d+\.\d+$/
cache: npm
install:
- npm install -g npm@latest
- npm install
- |-
if [ "$DIALECT" = "postgres-native" ]; then npm install pg-native; fi
env:
global:
- SEQ_DB=sequelize_test
- SEQ_USER=sequelize_test
- SEQ_PW=sequelize_test
- SEQ_HOST=127.0.0.1
- COVERAGE=true
before_script:
# setup docker
- "if [ $MARIADB_VER ]; then export MARIADB_ENTRYPOINT=$TRAVIS_BUILD_DIR/test/config/mariadb; fi"
- "if [ $MYSQL_VER ]; then export MYSQLDB_ENTRYPOINT=$TRAVIS_BUILD_DIR/test/config/mysql; fi"
- "if [ $POSTGRES_VER ] || [ $MARIADB_VER ] || [ $MYSQL_VER ]; then docker-compose up -d ${POSTGRES_VER} ${MARIADB_VER} ${MYSQL_VER}; fi"
- "if [ $MARIADB_VER ]; then docker run --link ${MARIADB_VER}:db -e CHECK_PORT=3306 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"
- "if [ $MYSQL_VER ]; then docker run --link ${MYSQL_VER}:db -e CHECK_PORT=3306 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"
- "if [ $POSTGRES_VER ]; then docker run --link ${POSTGRES_VER}:db -e CHECK_PORT=5432 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"
script:
- |-
if [ "$COVERAGE" = true ]; then npm run cover && bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info; else npm run test; fi
jobs:
include:
- stage: lint
node_js: '8'
script:
- npm run lint
- npm run lint-docs
- npm run test-typings
- stage: test
node_js: '6'
env: DIALECT=sqlite
- stage: test
node_js: '6'
sudo: required
env: MARIADB_VER=mariadb-103 SEQ_MARIADB_PORT=8960 DIALECT=mariadb
- stage: test
node_js: '6'
sudo: required
env: MYSQL_VER=mysql-57 SEQ_MYSQL_PORT=8980 DIALECT=mysql
- stage: test
node_js: '6'
sudo: required
env: POSTGRES_VER=postgres-10 SEQ_PG_PORT=8991 DIALECT=postgres
- stage: test
node_js: '6'
sudo: required
env: POSTGRES_VER=postgres-10 SEQ_PG_PORT=8991 SEQ_PG_MINIFY_ALIASES=1 DIALECT=postgres
script:
- npm run test-integration
- stage: test
node_js: '6'
sudo: required
env: POSTGRES_VER=postgres-95 SEQ_PG_PORT=8990 DIALECT=postgres-native
- stage: release
node_js: '8'
script:
- npm run semantic-release
stages:
- lint
- test
- name: release
if: branch = v5 AND type = push AND fork = false
version: '{build}'
platform:
- x64
services:
- mssql2017
shallow_clone: true
environment:
matrix:
- { NODE_VERSION: 6, DIALECT: mssql, COVERAGE: true }
install:
- ps: Install-Product node $env:NODE_VERSION x64
- ps: |
$pkg = ConvertFrom-Json (Get-Content -Raw package.json)
$pkg.devDependencies.PSObject.Properties.Remove('sqlite3')
$pkg.devDependencies.PSObject.Properties.Remove('pg-native')
ConvertTo-Json $pkg | Out-File package.json -Encoding UTF8
- npm install
build: off
before_test:
- ps: . .\scripts\appveyor-setup.ps1
test_script:
- 'IF "%COVERAGE%" == "true" (npm run cover) ELSE (npm test)'
after_test:
- ps: |
$env:PATH = 'C:\Program Files\Git\usr\bin;' + $env:PATH
if (Test-Path env:\COVERAGE) {
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
bash codecov.sh -f "coverage\lcov.info"
}
branches:
only:
- master
- v5
- /^greenkeeper/.*$/
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!