Skip to content

46 add unit tests

46 add unit tests #5

Workflow file for this run

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
with:
path : gst-signalling
- name: Install Gst Signalling Server
run: |
cd $GITHUB_WORKSPACE
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: |
cd $GITHUB_WORKSPACE/gst-signalling
python -m pip install --upgrade pip
pip install .[dev]
- name: Unit tests
uses: BerniWittmann/background-server-action@v1
with:
command: coverage run -m pytest, coverage xml, coverage json, coverage html
start: cd $GITHUB_WORKSPACE/gst-plugins-rs/net/webrtc/signalling/, cargo run --bin gst-webrtc-signalling-server
wait-on: 'http://localhost:8443'
- 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