Skip to content

Commit

Permalink
Add unit test code coverage minimum requirement
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel Mitchell <[email protected]>
  • Loading branch information
npmitche committed Jan 9, 2025
1 parent 68d5415 commit 1cb1b98
Showing 1 changed file with 41 additions and 6 deletions.
47 changes: 41 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-22.04
container:
image: docker://${{ matrix.distro.image_prefix }}${{ matrix.distro.name }}:${{ matrix.distro.tag }}

environment: pullrequests
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
modinfo "${MODULE}"
- name: Upload Linux driver from ${{ steps.modinfo.outputs.module_path }}
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: chipsec-${{ steps.versions.outputs.chipsec }}.${{ matrix.distro.name }}-${{ matrix.distro.tag }}${{ matrix.distro.variant }}-${{ steps.versions.outputs.kernel }}.${{ steps.versions.outputs.uname_m }}
path: ${{ steps.modinfo.outputs.module_path }}
Expand Down Expand Up @@ -180,14 +180,14 @@ jobs:
run: python setup.py build_ext -i

- name: Upload Windows Main driver
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: chipsec_drivers_windows_x64_py${{ matrix.versions.python }}_win${{ matrix.versions.window }}
path: drivers/windows/chipsec/x64
if-no-files-found: error

- name: Upload Windows PCI Filter driver
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: pcifilter_drivers_windows_x64_py${{ matrix.versions.python }}_win${{ matrix.versions.window }}
path: drivers/windows/pcifilter/x64
Expand Down Expand Up @@ -231,6 +231,35 @@ jobs:
with:
egress-policy: audit

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Dump vars context
env:
VARS_CONTEXT: ${{ toJson(vars) }}
run: echo "$VARS_CONTEXT"

- name: Set up Python ${{ matrix.versions.python }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
Expand All @@ -246,7 +275,7 @@ jobs:
run: |
sudo apt-get update -q
sudo apt-get install -qqy dkms nasm python3-setuptools
pip install distro pytest
pip install distro pytest pytest-cov
pip install -r linux_requirements.txt
sudo pip uninstall importlib_metadata
sudo pip install importlib_metadata --force-reinstall
Expand All @@ -267,7 +296,13 @@ jobs:
run: python3 -m unittest

- name: Run Python pytest
run: python -m pytest tests
env:
MINCOV: ${{ vars.COVERAGE_MINIMUM_REQUIREMENT }}
run: |
echo "${{ vars }}"
echo "${{ vars.COVERAGE_MINIMUM_REQUIREMENT }}"
echo "${{ vars.coverage_minimum_requirement }}"
python -m pytest --cov --cov-report=term-missing --cov-fail-under="${{ vars.coverage_minimum_requirement }}"
- name: Run xml cfg checker
run: |
Expand Down

0 comments on commit 1cb1b98

Please sign in to comment.