Skip to content

Merge pull request #33 from nyu-devops/sp25-updates #62

Merge pull request #33 from nyu-devops/sp25-updates

Merge pull request #33 from nyu-devops/sp25-updates #62

Workflow file for this run

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
container: python:3.11-slim
services:
couchdb:
image: couchdb:latest
ports:
- 5984:5984
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: pass
options: >-
--health-cmd "curl -X GET http://couchdb:5984/"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python package dependencies
run: |
python -m pip install -U pip pipenv
pipenv install --system --dev
- name: Run Code Quality Checks
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
# check for complexity. The GitHub editor is 127 chars wide
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
# Run pylint on the service
pylint service tests --max-line-length=127
- name: Create the test database
run: |
apt-get update
apt-get install -y curl
curl -X PUT http://admin:pass@couchdb:5984/test
- name: Run unit tests with pytest
run: pytest --pspec --cov=service --cov-fail-under=95 --disable-warnings --cov-report=xml
env:
FLASK_APP: "wsgi:app"
BINDING_CLOUDANT: '{"username":"admin","password":"pass","host":"couchdb","port":5984,"url":"http://admin:pass@couchdb:5984"}'
- name: Install packages required by Codecov
run: apt-get update && apt-get install -y git curl gpg
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: nyu-devops/lab-flask-restplus-swagger