Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enhance testing CI/CD #117

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Run pytest
run: |
pixi run -e ${{ matrix.env }} test
pixi run -e ${{ matrix.env }} test -s -vv

- name: Upload coverage report artifact to be used by Codecov
# only upload if matrix.os is ubuntu-latest and matrix.python-version is 3.12
Expand All @@ -40,7 +40,14 @@ jobs:
with:
name: coverage-report
path: coverage-report


- name: JUnit Test Summary
id: pytest-summary
uses: test-summary/action@v2
with:
paths: .cache/test-results/**/*.xml
show: "fail,skip"
if: always()
################################################################################################
# Codecov: Run codecov to check coverage
################################################################################################
Expand Down
188 changes: 0 additions & 188 deletions .github/workflows/ci-cd.yml.disabled

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/cleanup_caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
echo "Fetching list of cache key"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
68 changes: 68 additions & 0 deletions config/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[pytest]
# Minimum required pytest version for this configuration
# Ensures compatibility with the specified features
minversion = 7.0

cache_dir=.cache/pytest

# Configure console output style
# Sets the format of test result output
console_output_style = progress

# Additional command-line options to always include
# Sets default behavior for test runs
addopts =
# Show detailed test progress and results
# Improves visibility of test execution
; --verbose
# Show local variables in tracebacks
# Helps with debugging failed tests
--showlocals
# Tracks code coverage during test execution
--cov
# Output coverage report in terminal
# Provides immediate feedback on coverage
--cov-report=term-missing
# Generate XML coverage report
# Creates detailed coverage report for upload to code coverage services
--cov-report=xml:coverage-report/coverage.xml
# Generate HTML coverage report
# Creates detailed coverage report for analysis
--cov-report=html:coverage-report/htmlcov
# Point to coverage config file
# Allows customization of coverage report generation
--cov-config=config/coverage.toml
# xdist_group
# sends tests to the same worker if they are in the same group
--dist=loadgroup
# xdist numprocesses
--numprocesses=auto
--maxprocesses=12

# Junit params
# XML path
--junitxml=.cache/test-results/junit.xml

# JUnit XML report
# Junit is a widely used XML format for test reports
junit_suite_name = readii


# Patterns for test discovery
# Defines which files are considered test files
testpaths = tests

# Files to ignore during test collection
# Excludes specified files from testing
norecursedirs = *.egg .eggs dist build docs .tox .git __pycache__

# Test filename patterns
# Defines patterns for test file discovery
python_files = test_*.py *_test.py *_tests.py

# Ignore warnings
# Suppresses warnings during test execution
filterwarnings =
ignore::DeprecationWarning
# Add specific warning messages to ignore here
ignore::UserWarning:pydicom.*
Loading