generated from GSTT-CSC/project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (35 loc) · 1.82 KB
/
development_test.yml
File metadata and controls
47 lines (35 loc) · 1.82 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Development tests
on:
pull_request:
env:
PROJECT_NAME: hipposeg # the project name
APP_DIR: project
SOURCE_DIR: project # the name of the main directory that contains the project code
TEST_DIR: tests # the name of the directory that contains the tests
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Build and tag image
run: docker build -t $PROJECT_NAME:latest .
- name: Setup flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
docker run --mount type=bind,source=$(pwd),target=/$APP_DIR $PROJECT_NAME flake8 $SOURCE_DIR --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
docker run --mount type=bind,source=$(pwd),target=/$APP_DIR $PROJECT_NAME flake8 $SOURCE_DIR --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
docker run --mount type=bind,source=$(pwd),target=/$APP_DIR $PROJECT_NAME coverage run -m --source=$SOURCE_DIR pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=$SOURCE_DIR $TEST_DIR/ | tee pytest-coverage.txt
- name: Pytest coverage comment
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml