forked from laudio/pyodbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
65 lines (50 loc) · 1.87 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
dist: bionic
language: python
python:
- "3.7"
branches:
only:
- master
addons:
apt:
packages:
- docker-ce
install:
# Semver Bash
- sudo curl https://raw.githubusercontent.com/fsaintjacques/semver-tool/2.1.0/src/semver -o /usr/local/bin/semver && sudo chmod +x /usr/local/bin/semver
- semver --version
# Hub
- sudo snap install hub --classic
- hub --version
# pyright
- npm install -g [email protected]
before_script:
- export IMAGE_NAME='laudio/pyodbc'
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- git fetch --tags
- git config --global user.name "Brother"
- git config --global user.email "[email protected]"
# Generate .env.test file
- cp .env.example .env.test
- export $(egrep -v '^#' .env.test | xargs)
script:
# Build docker images
- make clean build
# Spin up a mssql, pg & mysql database server containers
- docker run --name test-mysql-server -e MYSQL_USER=${TEST_MYSQL_DB_USER} -e MYSQL_DATABASE=${TEST_MYSQL_DB_NAME} -e MYSQL_PASSWORD=${TEST_MYSQL_DB_PASSWORD} -d -p 3306:3306 mysql/mysql-server:latest
- docker run --name test-mssql-server -e ACCEPT_EULA=Y -e SA_PASSWORD=${TEST_MSSQL_DB_PASSWORD} -d -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest
- docker run --name test-pg-server -e POSTGRES_USER=${TEST_PG_DB_USER} -e POSTGRES_DB=${TEST_PG_DB_NAME} -e POSTGRES_PASSWORD=${TEST_PG_DB_PASSWORD} -d -p 5432:5432 postgres
- sleep 20s
# Run tests
# Publish image to registry if merged into master.
- make test && ./release.sh
- make lint-examples
# static type checking
- make check
# List docker images that are built (Just for information.)
- docker images laudio/*
after_script:
# Stop the running containers
- docker stop test-mssql-server
- docker stop test-pg-server
- docker stop test-mysql-server