-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (33 loc) · 1.1 KB
/
unit-test.yml
File metadata and controls
41 lines (33 loc) · 1.1 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
name: Python Unit Tests
on:
workflow_dispatch:
pull_request:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
run_tests:
runs-on: [ self-hosted ]
container: python:3.9
steps:
- uses: actions/checkout@v3
- name: Install xmllint
run: |
apt-get update
apt-get install -y libxml2-utils bc
- name: Install package and run unit tests with coverage
id: extract_coverage
shell: bash
run: |
source ./dev-setup.sh
pytest test/unit -s --cov=nodescraper --cov-report=xml --cov-report=term --cov-fail-under=70 --maxfail=1 --disable-warnings -v
- name: Print coverage
run: |
total_coverage=$(xmllint --xpath "string(//coverage/@line-rate)" coverage.xml)
total_coverage_percentage=$(echo "$total_coverage * 100" | bc)
echo "Total Coverage: $total_coverage_percentage%"
echo "coverage_percentage=$total_coverage_percentage" >> $GITHUB_ENV
- name: Display total coverage in Summary
run: |
echo "Total Coverage: ${{ env.coverage_percentage }}" >> $GITHUB_STEP_SUMMARY