desktop app for engine #17
Workflow file for this run
This file contains hidden or 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: Python Unit Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install -r tools/sensors_data_display_api/requirements.txt | |
python3 -m pip install coverage | |
- name: Run unit tests | |
run: | | |
cd tools/sensors_data_display_api/tests/ | |
coverage run -m unittest discover -s . -v | |
- name: Check Code Coverage | |
run: | | |
cd tools/sensors_data_display_api/tests/ | |
coverage_report=$(coverage report -m) | |
total_coverage=$(echo "$coverage_report" | grep "TOTAL" | awk '{print $NF}' | tr -d '%') # Usuwanie procentu | |
echo "Całkowita procentowa pokrywalność kodu: $total_coverage%" | |
if [ $total_coverage -lt 75 ]; then | |
echo "Zbyt małe pokrycie kodu" | |
exit 1 | |
fi | |
shell: bash |