Running Python Unit Tests for Splunk-App-Action #33
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
# This is a basic workflow to run automated test-cases on GitHub App Action | |
name: Running Python Unit Tests for Splunk-App-Action | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
on: | |
push: | |
branches: | |
- 'develop' | |
pull_request: | |
branches: | |
- '*' | |
- '*/*' | |
- '**' | |
workflow_dispatch: | |
jobs: | |
python-unit-tests: | |
name: "Running Python Unit Test Cases" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r tests/requirements.txt | |
- name: Run Python Unit Tests | |
run: pytest tests --junitxml=junit/test-results.xml --cov=src --cov-config=tests/.coveragerc --cov-report=xml | |
- name: Adding GitHub action step summary | |
uses: VatsalJagani/[email protected] | |
with: | |
pytest_results_file: "junit/test-results.xml" | |
pytest_cov_file: "coverage.xml" | |
pytest_cov_failure_threshold: 40 | |
if: ${{ always() }} | |
- name: Linting with Ruff | |
run: ruff check --ignore=E721,E722,E401 --output-format=github . | |
# continue-on-error: true # need to remove this later on to catch the errors anf fail the workflow on linting errors | |