-
Notifications
You must be signed in to change notification settings - Fork 454
68 lines (58 loc) · 2.09 KB
/
Copy pathworkflow.yml
File metadata and controls
68 lines (58 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
container: python:3.12-slim
# Required services
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis:8-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