Updates for Spring 2024 Semester #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Build | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'README.md' | |
- '.vscode/**' | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- 'README.md' | |
- '.vscode/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# use a known build environment | |
container: python:3.11-slim | |
# Required services | |
services: | |
# Label used to access the service container | |
postgres: | |
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@v2 | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip poetry | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Linting | |
run: | | |
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics | |
pylint service tests --max-line-length=127 | |
- name: Run unit tests with green | |
run: | | |
pytest --pspec --cov=service --cov-fail-under=95 --disable-warnings | |
env: | |
DATABASE_URI: "postgresql+psycopg://postgres:pgs3cr3t@postgres:5432/testdb" | |
FLASK_APP: "wsgi:app" | |
- name: Upload code coverage | |
uses: codecov/[email protected] |