Skip to content

Commit 8af7a31

Browse files
Merge pull request #11 from daniel-learns-with-coursera/add-ci-build
Add ci build
2 parents 4174daf + 4117b68 commit 8af7a31

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/ci-build.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
container: python:3.9-slim
14+
15+
services:
16+
postgres:
17+
image: postgres:alpine
18+
ports:
19+
- 5432:5432
20+
env:
21+
POSTGRES_PASSWORD: pgs3cr3t
22+
POSTGRES_DB: testdb
23+
options: >-
24+
--health-cmd pg_isready
25+
--health-interval 10s
26+
--health-timeout 5s
27+
--health-retries 5
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip wheel
36+
pip install -r requirements.txt
37+
38+
- name: Lint with flake8
39+
run: |
40+
flake8 service --count --select=E9,F63,F7,F82 --show-source --statistics
41+
flake8 service --count --max-complexity=10 --max-line-length=127 --statistics
42+
43+
- name: Run unit tests with nose
44+
run: nosetests
45+
env:
46+
DATABASE_URI: "postgresql://postgres:pgs3cr3t@postgres:5432/testdb"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# DevOps Capstone Template
22

3+
![Build Status](https://github.com/daniel-learns-with-coursera/devops-capstone-project/actions/workflows/ci-build.yaml/badge.svg)
4+
35
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
46
[![Python 3.9](https://img.shields.io/badge/Python-3.9-green.svg)](https://shields.io/)
57

0 commit comments

Comments
 (0)