Skip to content

31 cd to open shift kubernetes #53

31 cd to open shift kubernetes

31 cd to open shift kubernetes #53

Workflow file for this run

name: TDD Tests
on:
push:
branches:
- master
paths-ignore:
- "README.md"
- ".vscode/**"
- "**.md"
pull_request:
branches:
- master
paths-ignore:
- "README.md"
- ".vscode/**"
- "**.md"
jobs:
build:
runs-on: ubuntu-latest
container: python:3.11-slim
# Required services
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
env:
POSTGRES_PASSWORD: pgs3cr3t
POSTGRES_DB: testdb
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Steps for the build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install libraries for PostgreSQL
run: |
apt-get update
apt-get install -y gcc libpq-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
- name: Linting
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
# test for complexity. The GitHub editor is 127 chars wide
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
# Run pylint to catch other PEP8 errors
pylint service tests --max-line-length=127
- name: Run unit tests with PyTest
run: pytest --pspec --cov=service --cov-fail-under=95
env:
DATABASE_URI: "postgresql+psycopg://postgres:pgs3cr3t@postgres:5432/testdb"
# Uncomment the following 2 lines during hands-on lab
- name: Upload code coverage
uses: codecov/codecov-action@v3.1.4