Skip to content

Commit

Permalink
Setup GitHub Actions for unittests and PyLint (#24)
Browse files Browse the repository at this point in the history
Including configuration for Coverage & PyLint
  • Loading branch information
crazyscientist authored Oct 14, 2021
1 parent 83e6dbd commit 94b6f47
Show file tree
Hide file tree
Showing 6 changed files with 652 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = */tests/*
74 changes: 74 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: aimaas
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt -r backend/requirements_test.txt
- name: Test
run: pytest --cov-config=.coveragerc --cov=backend backend/tests
env:
PG_USER: aimaas
PG_PASSWORD: password
PG_HOST: localhost
PG_PORT: 5432
PG_DB: aimaas
TEST_PG_USER: aimaas
TEST_PG_PASSWORD: password
TEST_PG_HOST: localhost
TEST_PG_PORT: 5432
TEST_PG_DB: aimaas
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt pylint
- name: Lint with PyLint
run: |
pylint --rcfile=.pylintrc backend
Loading

0 comments on commit 94b6f47

Please sign in to comment.