-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (70 loc) · 2.18 KB
/
PackageTest.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
76
77
78
79
80
81
82
name: Test Package
on:
workflow_dispatch:
workflow_call:
push:
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
slurm_version:
- 20.11.9
- 22.05.11
- 23.02.5
python_version:
- 3.9
container:
image: ghcr.io/pitt-crc/test-env:${{ matrix.slurm_version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup environment
run: /usr/local/bin/entrypoint.sh
- name: Set Up Bank DB Location
run: mkdir -p /ihome/crc/bank
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install dependencies
run: poetry install --with tests
- name: Run tests with coverage
run: |
poetry run coverage run -m unittest discover
poetry run coverage report --omit="tests/*"
poetry run coverage xml --omit="tests/*" -o coverage.xml
# Report partial coverage results to codacy for the current python version
- name: Report partial coverage results
if: github.event_name != 'release'
shell: bash
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l Python -r coverage.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
# Tell codacy we are done reporting test coverage
report-code-coverage:
name: Report Coverage
if: github.event_name != 'release'
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Finish reporting coverage
shell: bash
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
# Use this job for branch protection rules
report-test-status:
name: Report Test Status
if: always()
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Check build status
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1