-
Notifications
You must be signed in to change notification settings - Fork 24
151 lines (146 loc) · 5.43 KB
/
main.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: "Test"
on:
push:
branches:
- master
paths-ignore:
- "docs/**"
pull_request:
paths-ignore:
- "docs/**"
jobs:
test-sqlalchemy-history:
name: test-python${{ matrix.python-version }}-${{ matrix.DB }}-sqla${{ matrix.sqla }}
strategy:
matrix:
python-version:
- "3.7"
- "3.12"
DB:
- "sqlite"
- "mssql"
- "mysql"
- "oracle"
- "postgres"
sqla:
- ">=1.4,<2"
- ">=2"
services:
mariadb:
image: mariadb
ports:
# Mysql is already exposed to 3306 port, so using 3307 instead
- 3307:3306
env:
MARIADB_DATABASE: sqlalchemy_history_test
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 10s
--health-timeout 5s
--health-retries 3
mysql:
image: mysql
ports:
- 3306:3306
env:
MYSQL_DATABASE: sqlalchemy_history_test
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: >-
--health-cmd "mysqladmin ping"
--health-interval 5s
--health-timeout 2s
--health-retries 3
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sqlalchemy_history_test
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 2s
--health-retries 3
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest # https://mcr.microsoft.com/en-us/product/mssql/server/about
ports:
- 1433:1433
env:
MSSQL_SA_PASSWORD: MSsql2022
ACCEPT_EULA: N
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U $DB_USER -P $SA_PASSWORD -Q 'select 1' -b -o /dev/null"
--health-interval 5s
--health-timeout 2s
--health-retries 3
oracle:
image: gvenzl/oracle-xe:21
ports:
- 1521:1521
env:
ORACLE_PASSWORD: Oracle2022
options: >-
--health-cmd healthcheck.sh
--health-interval 30s
--health-timeout 15s
--health-retries 5
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Project
run: |
python -m pip install --upgrade pip
pip install --upgrade poetry
poetry install
poetry add 'sqlalchemy${{ matrix.sqla }}'
- name: install oracle dependencies
if: ${{ matrix.DB == 'oracle' }}
run:
| # https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#installing-cx-oracle-on-linux
mkdir -p /opt/oracle
cd /opt/oracle
wget https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
unzip /opt/oracle/instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
sudo apt-get install libaio1
echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_21_8/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Run tests
run: |
poetry run pytest -x --cov --cov-report=lcov
env:
DB: ${{ matrix.DB }}
SQLA_20_WARNING: 1
- name: send coverage data to Coveralls
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
file: ./coverage.lcov
flag-name: sqlalchemy-history
parallel: true
lint:
runs-on: ubuntu-latest
steps:
- name: Black Validation
uses: psf/black@stable
with:
version: "23.3.0" # Last version which can be used in py3.7
options: "--check --verbose"
- uses: actions/checkout@v3
- name: ruff-action
uses: chartboost/ruff-action@v1
generate-coverage-report:
runs-on: ubuntu-20.04
needs: [test-sqlalchemy-history]
steps:
- name: Coveralls
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
parallel-finished: true