Skip to content

46 add unit tests

46 add unit tests #14

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
- 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