2020-04-06 21:39:52 +00:00
|
|
|
name: Testing
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ["*"]
|
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
|
|
|
- 'setup.*'
|
|
|
|
- '*.md'
|
|
|
|
- '*.rst'
|
|
|
|
tags-ignore: ["*"]
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 3
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:12-alpine
|
|
|
|
options: >-
|
|
|
|
--health-cmd "pg_isready"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 10s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432
|
|
|
|
env:
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-01-08 19:55:25 +00:00
|
|
|
python: [3.7, 3.8, 3.9]
|
2020-04-06 21:39:52 +00:00
|
|
|
container:
|
|
|
|
image: python:${{ matrix.python }}-alpine
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
|
|
|
|
- name: Install OS dependencies
|
2020-06-02 15:34:11 +00:00
|
|
|
run: apk --update add gcc libffi-dev linux-headers make musl-dev postgresql-dev
|
2020-04-06 21:39:52 +00:00
|
|
|
|
|
|
|
- name: Install testing dependencies
|
|
|
|
run: pip3 --no-cache-dir install -e '.[testing]'
|
|
|
|
|
|
|
|
- name: Create build directory
|
|
|
|
run: mkdir build
|
|
|
|
|
|
|
|
- name: Create build/test-environment
|
|
|
|
run: echo "export POSTGRES_URL=postgresql://postgres@postgres:5432/postgres" > build/test-environment
|
|
|
|
|
|
|
|
- name: Install UUID extension
|
2020-04-06 21:51:28 +00:00
|
|
|
run: |
|
2020-04-06 21:58:56 +00:00
|
|
|
apk add postgresql-client \
|
2020-04-07 20:59:06 +00:00
|
|
|
&& psql -q -h postgres -U postgres -d postgres -f fixtures/testing.sql
|
2020-04-06 21:39:52 +00:00
|
|
|
|
|
|
|
- name: Run flake8 tests
|
|
|
|
run: flake8
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: coverage run
|
|
|
|
|
|
|
|
- name: Output coverage
|
|
|
|
run: coverage report && coverage xml
|
|
|
|
|
|
|
|
- name: Upload Coverage
|
|
|
|
uses: codecov/codecov-action@v1.0.2
|
2020-04-06 22:33:17 +00:00
|
|
|
if: github.event_name == 'push' && github.repository == 'sprockets/sprockets-postgres'
|
2020-04-06 21:39:52 +00:00
|
|
|
with:
|
|
|
|
token: ${{secrets.CODECOV_TOKEN}}
|
|
|
|
file: build/coverage.xml
|
|
|
|
flags: unittests
|
|
|
|
fail_ci_if_error: true
|