-
Notifications
You must be signed in to change notification settings - Fork 40
75 lines (71 loc) · 2.51 KB
/
run_tests.yml
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
69
70
71
72
73
74
75
# 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: Running tests
on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:
jobs:
lint_flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Lint with flake8
run: |
pip install flake8
flake8 . --count --show-source --statistics
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
id-token: write
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Search for severe code errors with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: provision-with-micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment_all_backends.yml
environment-name: torchquad
cache-downloads: true
- name: Test with pytest
shell: bash -l {0}
run: |
micromamba activate torchquad
cd torchquad/tests/
pip install pytest
pip install pytest-error-for-skips
pip install pytest-cov
pytest -ra --error-for-skips --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=../../torchquad . | tee pytest-coverage.txt
- name: pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
if: github.event_name == 'pull_request'
continue-on-error: true
with:
pytest-coverage-path: ./torchquad/tests/pytest-coverage.txt
title: Coverage Report
badge-title: Overall Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
junitxml-path: ./torchquad/tests/pytest.xml