Skip to content

✅ locks tests

✅ locks tests #813

Workflow file for this run

name: Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
concurrency:
cancel-in-progress: true
group: |
${{ github.workflow }}-${{ github.event.pull_request.id || github.branch }}
jobs:
changes:
name: Change detection
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Detect changed files
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
src:
- .editorconfig
- .prettier-ignore
- pyproject.toml
- "requirements/**"
- "tests/**"
- "xthulu/**"
tests:
name: Unit tests
needs: changes
if: needs.changes.outputs.src == 'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install -U pip setuptools
pip install -e .[dev]
- name: Unit tests
run: coverage run --source=xthulu --omit="xthulu/__main__.py"
-m unittest
- name: Coverage report
run: |
total=$(coverage report --format=total)
cat >> $GITHUB_STEP_SUMMARY <<EOF
**:test_tube: :chart_with_upwards_trend: Test coverage: ${total}%**
EOF
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
- name: Coveralls
if: github.ref == 'refs/heads/main'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: pip install coveralls && coveralls