46 add unit tests #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Checkout tools repo | |
uses: actions/checkout@v4 | |
with: | |
repository: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git | |
path: gst-plugins-rs | |
ref: 0.12.8 | |
- name: Install Gst Signalling Server | |
run: | | |
cd $GITHUB_WORKSPACE/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 |