Skip to content

Commit

Permalink
Merge pull request #15 from att1106/add-ci-build
Browse files Browse the repository at this point in the history
added badge for github actions
  • Loading branch information
att1106 authored Nov 14, 2023
2 parents ad92189 + dc95bba commit e48faab
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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: pgs3cr3t
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 service --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 service --count --max-complexity=10 --max-line-length=127 --statistics
- name: Run unit tests with nose
run: nosetests
env:
DATABASE_URI: "postgresql://postgres:pgs3cr3t@postgres:5432/testdb"

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Build Status](https://github.com/att1106/devops-capstone-project/actions/workflows/ci-build.yaml/badge.svg)

# DevOps Capstone Template

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
Expand Down
4 changes: 2 additions & 2 deletions service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def create_accounts():
# LIST ALL ACCOUNTS
######################################################################


@app.route("/accounts", methods=["GET"])
def list_accounts():
"""
Expand All @@ -77,7 +78,6 @@ def list_accounts():
######################################################################
# READ AN ACCOUNT
######################################################################

@app.route("/accounts/<int:account_id>", methods=["GET"])
def get_accounts(account_id):
"""
Expand All @@ -94,7 +94,6 @@ def get_accounts(account_id):
######################################################################
# UPDATE AN EXISTING ACCOUNT
######################################################################

@app.route("/accounts/<int:account_id>", methods=["PUT"])
def update_accounts(account_id):
"""
Expand All @@ -116,6 +115,7 @@ def update_accounts(account_id):
# DELETE AN ACCOUNT
######################################################################


@app.route("/accounts/<int:account_id>", methods=["DELETE"])
def delete_accounts(account_id):
"""
Expand Down

0 comments on commit e48faab

Please sign in to comment.