Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 3fc53f9

Browse files
Test Suite on GitHub actions. (#194)
* First pass at GitHub actions * Add mysql service * Fix workflow * Setup MYSQL_USER, MYSQL_PASSWORD * Tweak mysql service * Add postgresql service * Fix Postgres PORT * Add aiopg to test suite * Expose MySQL on default port * Tweak workflow * Add MYSQL_ROOT_PASSWORD
1 parent 15ecd04 commit 3fc53f9

File tree

4 files changed

+60
-46
lines changed

4 files changed

+60
-46
lines changed

.github/workflows/test-suite.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Test Suite
3+
4+
on:
5+
push:
6+
branches: ["master"]
7+
pull_request:
8+
branches: ["master"]
9+
10+
jobs:
11+
tests:
12+
name: "Python ${{ matrix.python-version }}"
13+
runs-on: "ubuntu-latest"
14+
15+
strategy:
16+
matrix:
17+
python-version: ["3.6", "3.7", "3.8"]
18+
19+
services:
20+
mysql:
21+
image: mysql:5.7
22+
env:
23+
MYSQL_USER: username
24+
MYSQL_PASSWORD: password
25+
MYSQL_ROOT_PASSWORD: password
26+
MYSQL_DATABASE: testsuite
27+
ports:
28+
- 3306:3306
29+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
30+
31+
postgres:
32+
image: postgres:10.8
33+
env:
34+
POSTGRES_USER: username
35+
POSTGRES_PASSWORD: password
36+
POSTGRES_DB: testsuite
37+
ports:
38+
- 5432:5432
39+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
40+
41+
steps:
42+
- uses: "actions/checkout@v2"
43+
- uses: "actions/setup-python@v1"
44+
with:
45+
python-version: "${{ matrix.python-version }}"
46+
- name: "Install dependencies"
47+
run: "scripts/install"
48+
- name: "Run tests"
49+
env:
50+
TEST_DATABASE_URLS: "sqlite:///testsuite, mysql://username:password@localhost:3306/testsuite, postgresql://username:password@localhost:5432/testsuite, postgresql+aiopg://username:password@localhost:5432/testsuite"
51+
run: "scripts/test"

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

scripts/install

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
#!/bin/sh -e
22

33
# Use the Python executable provided from the `-p` option, or a default.
4-
[[ $1 = "-p" ]] && PYTHON=$2 || PYTHON="python3"
5-
6-
MIN_VERSION="(3, 6)"
7-
VERSION_OK=`"$PYTHON" -c "import sys; print(sys.version_info[0:2] >= $MIN_VERSION and '1' or '');"`
8-
9-
if [[ -z "$VERSION_OK" ]] ; then
10-
PYTHON_VERSION=`"$PYTHON" -c "import sys; print('%s.%s' % sys.version_info[0:2]);"`
11-
DISP_MIN_VERSION=`"$PYTHON" -c "print('%s.%s' % $MIN_VERSION)"`
12-
echo "ERROR: Python $PYTHON_VERSION detected, but $DISP_MIN_VERSION+ is required."
13-
echo "Please upgrade your Python distribution to install Databases."
14-
exit 1
15-
fi
4+
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"
165

176
REQUIREMENTS="requirements.txt"
187
VENV="venv"
19-
PIP="$VENV/bin/pip"
208

219
set -x
22-
"$PYTHON" -m venv "$VENV"
10+
11+
if [ -z "$GITHUB_ACTIONS" ]; then
12+
"$PYTHON" -m venv "$VENV"
13+
PIP="$VENV/bin/pip"
14+
else
15+
PIP="pip"
16+
fi
17+
2318
"$PIP" install -r "$REQUIREMENTS"
2419
"$PIP" install -e .

scripts/test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ if [ -d 'venv' ] ; then
55
export PREFIX="venv/bin/"
66
fi
77

8-
export VERSION_SCRIPT="import sys; print('%s.%s' % sys.version_info[0:2])"
9-
export PYTHON_VERSION=`python -c "$VERSION_SCRIPT"`
10-
118
if [ -z "$TEST_DATABASE_URLS" ] ; then
129
echo "Variable TEST_DATABASE_URLS must be set."
1310
exit 1

0 commit comments

Comments
 (0)