Fix Issues in STAC/Properties Generation #167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@main | |
with: | |
python-version: ${{ matrix.python-version }} | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-cov coverage-badge . | |
- name: Test with pytest and coverage badge | |
if: matrix.python-version != '3.12' | |
run: | | |
pytest --cov=paint | |
coverage-badge -fo coverage.svg | |
coverage report -m --format markdown > cov_report.txt | |
- name: Post coverage report to PR | |
if: matrix.python-version == '3.11' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
path: cov_report.txt | |
- name: Tests with pytest and no badge | |
if: matrix.python-version == '3.12' | |
run: | | |
pytest --cov=paint | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v19 | |
id: verify-changed-files | |
with: | |
files: coverage.svg | |
- name: Commit files | |
if: steps.verify-changed-files.outputs.files_changed == 'true' && matrix.python-version == '3.11' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add coverage.svg | |
git commit -m "Updated coverage.svg" | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' && matrix.python-version == '3.11' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
branch: ${{ github.head_ref }} |