Bump tj-actions/verify-changed-files from 19 to 20 #549
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
# CI/CD pipeline | |
name: pipeline for latest and greatest packages | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
# Tests on all platforms | |
# Here we use a freeze file so we are 100% sure that if there is any failure | |
# is because of dymoval itself and not because of some weird dependency | |
# stuff | |
# We test by downloading ALL the dependencies, including the dev ones. | |
pip_tests_dev: | |
name: Pip install (dev) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Formatting source code (black) | |
uses: psf/black@stable | |
with: | |
src: "./src/dymoval" | |
- name: Install dependencies dev (pip) | |
run: | | |
python -m pip install ".[dev]" | |
- name: Run tests (flake8, mypy, pytest, sphinx) | |
run: | | |
flake8 . | |
mypy . | |
coverage run -m pytest . | |
cd docs | |
make clean | |
sphinx-apidoc -f -n -o ./docs/source ../src/dymoval/ | |
make html | |
cd .. | |
- name: Build wheel and sdist (pdm) | |
run: | | |
python -m pip install ".[build]" | |
pdm build | |
pip_tests_user: | |
# The purpose is to check if it is OK to release on pypi, i.e. if the user | |
# can use it with the default packages without the need of installing dev | |
# packages. | |
# If it passes, then it is OK for release. | |
# Conda releases must be done manually anyways. | |
name: Pip install (user) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies user (pip) | |
run: | | |
python -m pip install . | |
- name: Run tests (flake8, mypy, pytest, sphinx) | |
run: | | |
python -m pip install pytest | |
python -m pip install coverage | |
coverage run -m pytest . | |
docs: | |
# Build doc and push to gh-pages | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
- name: Build docs (sphinx) | |
run: | | |
python -m pip install ".[dev]" | |
cd docs | |
make clean | |
sphinx-apidoc -f -n -o ./docs/source ../src/dymoval/ | |
make html | |
cd .. | |
- name: Init new repo in dist folder and commit generated files | |
run: | | |
cd docs/build/html/ | |
git init | |
touch .nojekyll | |
git add -A | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -m "deploy" | |
- name: Force push to destination branch | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN}} | |
branch: gh-pages | |
force: true | |
directory: ./docs/build/html | |
- name: Run test for generating .coverage file | |
run: | | |
coverage run --source=dymoval --branch -m pytest | |
coverage report -m | |
- name: Coverage Badge | |
uses: tj-actions/[email protected] | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v20 | |
id: changed_files | |
with: | |
files: coverage.svg | |
- name: Commit files | |
if: steps.changed_files.outputs.files_changed == 'true' | |
run: | | |
rm .coverage | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add coverage.svg | |
git commit -m "Updated coverage.svg" | |
- name: Push changes | |
if: steps.changed_files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
branch: ${{ github.ref }} |