generated from nyu-devops/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 1.84 KB
/
tdd-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI Build
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.vscode/**'
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- 'README.md'
- '.vscode/**'
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-slim
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: pgs3cr3t
POSTGRES_DB: testdb
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Steps for the build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install OS dependencies
run: |
apt-get update
apt-get install -y gcc libpq-dev
- name: Install Python packages
run: |
python -m pip install --upgrade pip wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run Code Quality Checks
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
# Run pylint on the service
pylint service
- name: Run unit tests with nose
run: |
export FLASK_APP=service:app
nosetests
env:
DATABASE_URI: "postgresql://postgres:pgs3cr3t@postgres:5432/testdb"
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
version: "v0.1.13"