Skip to content
Merged
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
49 changes: 6 additions & 43 deletions .github/workflows/testing_main_dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Automated testing and coverage (in protected branches)
name: Automated testing and coverage


on:
Expand Down Expand Up @@ -26,48 +26,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install specific setuptools version that reliably includes pkg_resources
python -m pip install --force-reinstall "setuptools>=65.0.0" wheel
# Verify pkg_resources is available
python -c "import pkg_resources; print(f'pkg_resources version: {pkg_resources.__version__}')" || echo "pkg_resources not available, continuing with alternatives"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest coverage
# Install the package in editable mode so modules are available
pip install -e .
# Install badge generation tools with fallbacks
pip install genbadge[coverage] || echo "genbadge installation failed"
pip install coverage-badge || echo "coverage-badge installation failed"
pip install poetry
poetry install --with dev

- name: Run tests with coverage
run: |
coverage run --source=pv_tool_logic -m pytest
coverage report -m
coverage json
if [ -f readme_images/coverage.svg ]; then rm readme_images/coverage.svg; fi
# Multiple fallback strategies for badge generation
{
genbadge coverage -o readme_images/coverage.svg && echo "Badge generated with genbadge"
} || {
coverage-badge -o readme_images/coverage.svg && echo "Badge generated with coverage-badge"
} || {
python -m pv_tool_logic.utilities.generate_coverage_badge readme_images/coverage.svg && echo "Badge generated with module script"
} || {
python generate_coverage_badge.py readme_images/coverage.svg && echo "Badge generated with standalone script"
} || {
echo "All badge generation methods failed, skipping badge creation"
}

- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Actions"
git pull
git add .
if ! git diff --cached --quiet; then
git commit -m "Testing and coverage"
git push
else
echo "No changes to commit"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
poetry run coverage run --source=pv_tool_logic -m pytest
poetry run coverage report -m
poetry run coverage json
26 changes: 14 additions & 12 deletions .github/workflows/testing_pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
name: Automated testing and coverage (during pull request)
name: Automated testing (during pull request)


on:
pull_request:
branches: [ "dev" ]
workflow_dispatch:


jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.11', '3.12']

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest coverage
pip install -e .
python -m pip install --upgrade pip
pip install poetry
poetry install --with dev

- name: Run tests with coverage
run: |
coverage run --source=pv_tool_logic -m pytest
coverage report -m
poetry run coverage run --source=pv_tool_logic -m pytest
poetry run coverage report -m
Loading
Loading