[Chore] action: use coverage.py directly in test CI #1113
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: test CI | |
on: [pull_request] | |
jobs: | |
pytest_with_coverage: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v3 | |
- name: Build ota-test_base docker image | |
run: | | |
docker-compose -f docker/docker-compose_tests.yml build | |
- name: Execute pytest with coverage trace under ota-test_base container | |
# NOTE: test_result folder holds the coverage.xml, check docker-compose_tests.yml for | |
# coverage execution command line and volumes configurations. | |
run: | | |
set -o pipefail | |
mkdir test_result | |
docker-compose -f docker/docker-compose_tests.yml up --no-log-prefix --abort-on-container-exit | |
# export the coverage report to the comment! | |
- name: Add coverage report to PR comment | |
continue-on-error: true | |
uses: MishaKav/[email protected] | |
with: | |
pytest-xml-coverage-path: ./test_result/coverage.xml | |
python_lint_check: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install test dependencies | |
run: | | |
python -m pip install -q --upgrade pip | |
python -m pip install -q -r tests/requirements.txt | |
- name: Lint codes without modification | |
run: | | |
$pythonLocation/bin/python -m black ./otaclient --check | |
- name: Lint codes for syntax check | |
run: | | |
$pythonLocation/bin/python -m flake8 ./otaclient | |
markdown_lint_check: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v3 | |
- name: markdownlint-cli | |
uses: nosborn/[email protected] | |
with: | |
files: . | |
config_file: .markdownlint.yaml | |
ignore_files: .markdownlintignore | |
#ignore_path: examples/.markdownlintignore | |
#rules: examples/rules/custom.js | |