| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
name: Python package |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [ develop, release/* ] |
| 9 |
pull_request: |
| 10 |
branches: [ develop ] |
| 11 |
schedule: |
| 12 |
- cron: '27 19 * * *' |
| 13 |
|
| 14 |
jobs: |
| 15 |
build: |
| 16 |
|
| 17 |
runs-on: ubuntu-latest |
| 18 |
strategy: |
| 19 |
matrix: |
| 20 |
python-version: [3.7, 3.8, 3.9, '3.10'] |
| 21 |
database: |
| 22 |
- pgsql |
| 23 |
- mysql |
| 24 |
- sqlite |
| 25 |
|
| 26 |
steps: |
| 27 |
- uses: actions/checkout@v2 |
| 28 |
- name: Set up Python ${{ matrix.python-version }} |
| 29 |
uses: actions/setup-python@v2 |
| 30 |
with: |
| 31 |
python-version: ${{ matrix.python-version }} |
| 32 |
- name: Install dependencies |
| 33 |
run: | |
| 34 |
python -m pip install --upgrade pip |
| 35 |
python -m pip install -r test-requirements.txt |
| 36 |
python -m pip install tox-gh-actions coveralls |
| 37 |
python -m pip install --upgrade wheel # stop pip complaining about a setup.py install |
| 38 |
sudo apt-get install python3-dev |
| 39 |
pip install . |
| 40 |
- name: Test with tox |
| 41 |
env: |
| 42 |
DB: ${{ matrix.database }} |
| 43 |
GA_PYTHON_VERSION: ${{ matrix.python-version }} |
| 44 |
run: | |
| 45 |
. ./github-ci.sh |
| 46 |
tox --workdir=. |
| 47 |
services: |
| 48 |
|
| 49 |
postgres: |
| 50 |
|
| 51 |
image: postgres |
| 52 |
|
| 53 |
env: |
| 54 |
POSTGRES_PASSWORD: postgres |
| 55 |
|
| 56 |
options: >- |
| 57 |
--health-cmd pg_isready |
| 58 |
--health-interval 10s |
| 59 |
--health-timeout 5s |
| 60 |
--health-retries 5 |
| 61 |
ports: |
| 62 |
|
| 63 |
- 5432:5432 |
| 64 |
mysql: |
| 65 |
|
| 66 |
image: mysql |
| 67 |
|
| 68 |
env: |
| 69 |
MYSQL_ALLOW_EMPTY_PASSWORD: 1 |
| 70 |
MYSQL_USER: test |
| 71 |
MYSQL_PASSWORD: mysql |
| 72 |
MYSQL_DATABASE: test |
| 73 |
ports: |
| 74 |
|
| 75 |
- 3306:3306 |
| 76 |
|
| 77 |
dev-deploy: |
| 78 |
name: Deploy Dev Package to PyPI |
| 79 |
needs: build |
| 80 |
if: github.event_name == 'push' |
| 81 |
&& (github.ref == 'refs/heads/develop' |
| 82 |
|| startsWith(github.ref, 'refs/heads/release/')) |
| 83 |
runs-on: ubuntu-latest |
| 84 |
steps: |
| 85 |
- uses: actions/checkout@v2 |
| 86 |
- name: Set up Python 3 |
| 87 |
uses: actions/setup-python@v2 |
| 88 |
with: |
| 89 |
python-version: 3 |
| 90 |
- name: Install Deploy Dependencies |
| 91 |
run: pip install wheel twine |
| 92 |
- name: Deploy |
| 93 |
run: ./deploy.sh |
| 94 |
env: |
| 95 |
TWINE_USERNAME: __token__ |
| 96 |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |