Updating PyMUSAS Development Requirements #353
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| workflow_dispatch: # Manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI. | |
| push: | |
| pull_request: | |
| release: | |
| types: [published] | |
| jobs: | |
| Validate-CITATION-cff: | |
| runs-on: ubuntu-latest | |
| name: Validate CITATION.cff | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Validate CITATION.cff | |
| id: validate_cff | |
| uses: dieghernan/cff-validator@v4 | |
| with: | |
| citation-path: "CITATION.cff" | |
| - name: Upload cff-validator error artifact if failed to validate | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ failure() && steps.validate_cff.conclusion == 'failure' }} | |
| with: | |
| name: citation-cff-errors | |
| path: citation_cff.md | |
| overwrite: true | |
| if-no-files-found: warn | |
| checks: | |
| name: checks | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| id: python-setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| id: setup-uv | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.9.6" | |
| enable-cache: true | |
| restore-cache: true | |
| save-cache: true | |
| prune-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install the project | |
| run: uv sync --locked | |
| - name: check uv cache is working | |
| if: steps.setup-uv.outputs.cache-hit == 'true' | |
| run: echo "uv cache was restored" | |
| - name: isort | |
| run: uv run isort --check-only pymusas tests scripts | |
| - name: flake8 Ubuntu and Mac | |
| if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} | |
| run: | | |
| uv run flake8 --config ./.flake8 pymusas tests scripts | |
| - name: flake8 Window | |
| if: ${{ runner.os == 'Windows' }} | |
| run: | | |
| uv run flake8 --config .\.flake8 pymusas tests scripts | |
| - name: Cache mypy | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./.mypy_cache | |
| key: ${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('uv.lock') }} | |
| - name: mypy | |
| run: uv run mypy | |
| - name: Code coverage testing | |
| run: | | |
| uv run coverage run | |
| - name: Code coverage report | |
| run: | | |
| uv run coverage report | |
| - name: Set pymusas cache home directory for Ubuntu and Mac | |
| if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} | |
| run: | | |
| echo "PYMUSAS_HOME=$HOME/.cache/doc_test_pymusas" >> "$GITHUB_ENV" | |
| - name: Set pymusas cache home directory for Windows | |
| if: ${{ runner.os == 'Windows' }} | |
| run: | | |
| echo "PYMUSAS_HOME=$HOME\.cache\doc_test_pymusas" >> $env:GITHUB_ENV | |
| - name: Cache Doc Test download files | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.PYMUSAS_HOME }} | |
| key: ${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-${{ env.PYMUSAS_HOME }} | |
| - name: Doc Tests | |
| run: | | |
| uv run coverage run -m pytest --doctest-modules pymusas/ | |
| - name: Build and Functional Tests Ubuntu and Mac | |
| if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} | |
| run: | | |
| uv build | |
| PYMUSAS_VERSION=$(uv run scripts/get_version.py ./pyproject.toml) | |
| uv run --with "dist/pymusas-${PYMUSAS_VERSION}-py3-none-any.whl" \ | |
| --with pytest --no-project --isolated pytest --doctest-modules pymusas/ | |
| uv run --with "dist/pymusas-${PYMUSAS_VERSION}-py3-none-any.whl" \ | |
| --with pytest --no-project --isolated pytest tests/functional_tests | |
| - name: Build and Functional Tests Windows | |
| if: ${{ runner.os == 'Windows' }} | |
| run: | | |
| uv build | |
| $PYMUSAS_VERSION = & { uv run scripts/get_version.py ./pyproject.toml } | |
| uv run --with "dist/pymusas-${PYMUSAS_VERSION}-py3-none-any.whl" --with pytest --no-project --isolated pytest --doctest-modules pymusas/ | |
| uv run --with "dist/pymusas-${PYMUSAS_VERSION}-py3-none-any.whl" --with pytest --no-project --isolated pytest tests/functional_tests | |
| update-binder-requirements: | |
| name: update-binder-requirements | |
| needs: checks | |
| if: github.ref == 'refs/heads/main' && github.repository == 'UCREL/pymusas' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: update env checkout | |
| uses: actions/checkout@v5 | |
| - name: update env commits | |
| run: | | |
| git branch | |
| git fetch --depth=1 origin binder-main | |
| git checkout -b binder-main origin/binder-main | |
| git checkout main binder/environment.yml | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| if [ $(git diff-index binder-main | wc -l) -gt 0 ]; then git commit -m "update"; git push origin binder-main; fi | |