Skip to content

Add GitHub Actions test workflow #1

Add GitHub Actions test workflow

Add GitHub Actions test workflow #1

Workflow file for this run

name: Test
on:
push:
branches:
- '*'
- '!main'
pull_request: {}
permissions:
contents: read
issues: read
checks: write
pull-requests: write
env:
FLASK_APP: blog
FLASK_ENV: development
GITHUB_USERNAME: jamiefdhurst
GITHUB_TOKEN: example
jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies
run: |
python -m pip install pylint pytest requests-mock coverage
python setup.py develop
- name: Test
run: |
coverage run -m pytest --verbose --junit-xml tests.xml
coverage xml -o coverage.xml
- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: tests
path: tests.xml
- name: Upload Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
action_fail: true
files: |
tests.xml
- name: Publish Code Coverage
uses: irongut/[email protected]
with:
filename: coverage.xml
badge: false
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '80 90'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md