diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml new file mode 100644 index 0000000..415eee4 --- /dev/null +++ b/.github/workflows/ci-build.yaml @@ -0,0 +1,48 @@ +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 -v --with-spec --spec-color --with-coverage --cover-package=service + env: + DATABASE_URI: "postgresql://postgres:pgs3cr3t@postgres:5432/testdb" + + diff --git a/README.md b/README.md index 002c561..99238d9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # devops-capstone-project6 +![Build Status](https://github.com/Moon-Knight13/devops-capstone-project/actions/workflows/ci-build.yaml/badge.svg) + + This is my captsone project for IBM. # DevOps Capstone Template