Skip to content

Commit

Permalink
Initial GitHub Actions workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed Nov 25, 2020
1 parent 31418d5 commit 3c72004
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

services:
postgres:
image: postgres:10
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
-${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
-${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
6 changes: 3 additions & 3 deletions auditlog_tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('TEST_DB_NAME', 'auditlog_tests_db'),
'NAME': os.getenv('TEST_DB_NAME', 'postgres'),
'USER': os.getenv('TEST_DB_USER', 'postgres'),
'PASSWORD': os.getenv('TEST_DB_PASS', ''),
'HOST': os.getenv('TEST_DB_HOST', '127.0.0.1'),
'PASSWORD': os.getenv('TEST_DB_PASS', 'postgres'),
'HOST': os.getenv('TEST_DB_HOST', 'postgres'),
'PORT': os.getenv('TEST_DB_PORT', '5432'),
}
}
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ basepython =
py37: python3.7
py36: python3.6
py35: python3.5


[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38

0 comments on commit 3c72004

Please sign in to comment.