From ba665e3c60849f1399666b9e92a1849f868394cc Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 28 Feb 2025 12:28:03 -0500 Subject: [PATCH 1/2] Added badge for GitHub Actions --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0121774..a178cf7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # DevOps Capstone Template +![Build Status](https://github.com/daniel-learns-with-coursera/devops-capstone-project/actions/workflows/ci-build.yaml/badge.svg) + [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Python 3.9](https://img.shields.io/badge/Python-3.9-green.svg)](https://shields.io/) From 4117b685fa230c14c9115a4ad45261d912411691 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 28 Feb 2025 12:29:29 -0500 Subject: [PATCH 2/2] completed ci build --- .github/workflows/ci-build.yaml | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci-build.yaml diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml new file mode 100644 index 0000000..f991e99 --- /dev/null +++ b/.github/workflows/ci-build.yaml @@ -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" \ No newline at end of file