From 7dcfefbd20c35cd4b4e7755bdd0cc44c180d9bc4 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Wed, 7 Aug 2024 12:29:57 +0200 Subject: [PATCH] enhancement #46: run tests with server in background --- .github/workflows/unit_tests.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 586d8fd..e7453a5 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -32,3 +32,26 @@ jobs: run: | 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 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/coverage@v3.1 + 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