-
Notifications
You must be signed in to change notification settings - Fork 10
65 lines (53 loc) · 1.79 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
# This workflow will install Python dependencies, run tests,
# and report test results and code coverage as artifacts. It will
# be called by the workflow that run tests against new PRs and as
# a first step in the workflow that publishes new Docker images.
name: A reusable workflow to build and run the unit test suite
on:
workflow_call:
workflow_dispatch:
jobs:
build_and_test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Retrieve harmony-netcdf-to-zarr repository
uses: actions/checkout@v3
- name: Set up Python 3.9 (version used by service)
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/core.txt -r requirements/dev.txt
- name: Run lint
run: |
flake8 --ignore=W503 harmony_netcdf_to_zarr
- name: Run tests
run: |
bin/test >& test_results.txt
- name: Generate coverage report
if: ${{ always() }}
run: |
coverage report -m >& coverage_report.txt
coverage html --dir htmlcov
- name: Archive test results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test result (Python 3.9)
path: test_results.txt
- name: Archive code coverage report (plain text)
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code coverage report (plain text)
path: coverage_report.txt
- name: Archive code coverage report (HTML)
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code coverage report (HTML)
path: htmlcov/*