-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (68 loc) · 1.81 KB
/
ci-build.yaml
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:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-slim
services:
postgres:
image: postgres:alpine
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: zas4fg4t
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
grep -v 'uwsgi\|#' requirements.txt | xargs pip install
- name: code format with black
run: |
black .
- name: Lint with flake8
run: |
flake8 . --ignore=W503,F401,E402,E203,E266,E231 --max-line-length=120 --statistics
- name: Run unit tests with nose
run: |
nosetests
env:
DATABASE_URI: "postgresql://postgres:zas4fg4t@postgres:5432/testdb"
- name: Create and save coverage badge
run: |
pip install coverage-badge
coverage-badge -o tests/coverage.svg -f
- uses: actions/upload-artifact@v3
with:
name: coverage-badge
path: tests/coverage.svg
badge:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: coverage-badge
path: tests
- name: Push new badge to repo
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Badge auto-generated by CI"
git push