Skip to content

S3 arguments

S3 arguments #80

Workflow file for this run

name: Tests and Style
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
python-version: [3.11.4]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Switch to Current Branch
run: git checkout ${{ env.BRANCH }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Run flake8
run: |
pip install flake8
flake8 --version
# stop the build if there are flake8 errors
flake8 . --count --show-source --statistics --max-line-length 120
- name: Run unit tests
run: |
pip install pytest
python -m pytest src/jp2_remediator/tests/unit
- name: Run coverage
run: |
pip install coverage
python -m coverage run -p -m pytest src/jp2_remediator/tests/unit
python -m coverage combine
python -m coverage report -m --skip-covered --fail-under=85
python -m coverage xml
python -m coverage json
# Fetch base branch for comparison (e.g., main)
- name: Fetch base branch
run: git fetch origin main
- name: Install diff-cover
run: |
pip install --user diff-cover
find $HOME -name "diff-cover" || echo "diff-cover not found"
- name: Add diff-cover to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
# Compare coverage with the base branch, if decreases fails, if under 85 percent fails
- name: Compare coverage
run: |
git checkout main
python -m coverage run -p -m pytest src/jp2_remediator/tests/unit
python -m coverage xml -o coverage-base.xml
git checkout -
diff-cover --compare-branch=main coverage.xml --fail-under=85
- name: Combine coverage percentage totals
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: Make badge
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 67d4eba1556653d896d2d36fcb3e5c7c
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}