Skip to content

Commit e86d363

Browse files
author
STS
committed
combine regression and unit/integration tests coverage
1 parent 7a471ff commit e86d363

4 files changed

Lines changed: 103 additions & 95 deletions

File tree

.github/workflows/regression_test.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# This is a workflow for Unit, Integration, and Regression Tests
2+
3+
name: Tests
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the main branch
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
unit_and_integration_tests:
18+
strategy:
19+
matrix:
20+
python-version: [3.11]
21+
os: [ubuntu-latest]
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Making virtual environment, linting
29+
run: |
30+
make testenv
31+
- name: Downloading test data
32+
run: |
33+
make get_test_data
34+
- name: Running tests
35+
run: |
36+
source .venv/bin/activate
37+
coverage run --source=jwave -m pytest -xvs --ignore=tests/regression_tests
38+
coverage xml -o coverage.unit.xml
39+
coverage html
40+
- name: "Upload coverage report for unit and integration tests"
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: coverage-unit
44+
path: ./coverage.unit.xml
45+
46+
regression_tests:
47+
strategy:
48+
matrix:
49+
python-version: [3.11]
50+
os: [ubuntu-latest]
51+
runs-on: ${{ matrix.os }}
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-python@v4
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
- name: Making virtual environment, linting
58+
run: |
59+
make testenv
60+
- name: Downloading test data
61+
run: |
62+
make get_test_data
63+
- name: Running tests
64+
run: |
65+
source .venv/bin/activate
66+
coverage run --source=jwave -m pytest -xvs ./tests/regression_tests
67+
coverage xml -o coverage.regression.xml
68+
coverage html
69+
- name: "Upload coverage report for regression tests"
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: coverage-regression
73+
path: ./coverage.regression.xml
74+
75+
combine_coverage:
76+
needs: [unit_and_integration_tests, regression_tests]
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v3
80+
- uses: actions/setup-python@v4
81+
with:
82+
python-version: 3.11
83+
- name: Download coverage reports
84+
uses: actions/download-artifact@v2
85+
with:
86+
name: coverage-unit
87+
- name: Download coverage reports
88+
uses: actions/download-artifact@v2
89+
with:
90+
name: coverage-regression
91+
- name: Install coverage
92+
run: pip install coverage
93+
- name: Combine reports
94+
run: |
95+
coverage combine coverage.unit.xml coverage.regression.xml
96+
coverage xml -o coverage.combined.xml
97+
- name: "Upload combined coverage to Codecov"
98+
uses: codecov/codecov-action@v3
99+
with:
100+
token: ${{ secrets.CODECOV_TOKEN }}
101+
files: ./coverage.combined.xml
102+
name: codecov-umbrella

.github/workflows/unit_and_integration_test.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

scripts/get_test_data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mkdir -p .test_data
2323
git clone https://github.com/ucl-bug/jwave-data.git .test_data
2424

2525
# Moving test data to the right place
26-
mv .test_data/tests/* ./tests
26+
cp -ur .test_data/tests/* ./tests/ && rm -r .test_data/tests/*
2727

2828
# Removing the temporary directory
2929
rm -rf .test_data

0 commit comments

Comments
 (0)