Skip to content

Merge pull request #59 from nyu-devops/upgrade-codecov #88

Merge pull request #59 from nyu-devops/upgrade-codecov

Merge pull request #59 from nyu-devops/upgrade-codecov #88

Workflow file for this run

name: CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container: python:3.11-slim
# Required services
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis:6-alpine
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Steps for the build
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: 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 --cov-report=xml
env:
DATABASE_URI: "redis://redis:6379"
######################################################################
# Create a CODECOV_TOKEN in Settings->Secrets and variables->Actions
# and then uncomment the CodeCov action during hands-on lab
######################################################################
- name: Install packages for Codecov to work
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-github-actions