generated from pollen-robotics/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.52 KB
/
unit_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
name: Pytest
on: [pull_request]
jobs:
tests:
runs-on: ubuntu-24.04
steps:
- name: Install Gstreamer
run: sudo apt-get -y install libssl-dev git python3-pip pkg-config libcairo2-dev gcc python3-dev libgirepository1.0-dev python3-gst-1.0 gir1.2-gst-plugins-bad-1.0 gstreamer1.0-plugins-bad gstreamer1.0
- name : Install Rust
uses: hecrj/setup-rust-action@v2
- name: Checkout code
uses: actions/checkout@v4
- name: Install Gst Signalling Server
run: |
git clone -b 0.12.8 --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
cd gst-plugins-rs/net/webrtc/signalling/
cargo build
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Unit tests
uses: BerniWittmann/background-server-action@v1
with:
command: timeout --signal=SIGTERM 30s bash -c 'until lsof -i :8443; do sleep 1; done' && coverage run -m pytest
start: cd $GITHUB_WORKSPACE/gst-plugins-rs/net/webrtc/signalling/ && cargo run --bin gst-webrtc-signalling-server
- name: Generate reports
run: |
coverage xml
coverage json
coverage html
- name: Archive code coverage html report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: htmlcov
- name: Get Cover
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract results
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: Make badge
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 17eb617c2e60c2dc189478dd3be6e323 # replace with your real Gist id.
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}