Skip to content

Updating PyMUSAS Development Requirements #1

Updating PyMUSAS Development Requirements

Updating PyMUSAS Development Requirements #1

name: Documentation-Check-Build-Deploy
on:
workflow_dispatch: # Manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI.
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
permissions:
contents: read # required to checkout repoistory
jobs:
doc-generated-check:
name: Check that the Python API documentation reflects the code base.
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache PIP
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev_requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -r requirements.txt
pip install --upgrade --upgrade-strategy eager -r dev_requirements.txt
pip install .[tests]
- name: Check if the Python API documentation is up to date if not raise an error
run: |
make create-api-docs
if [ $(git status -s | wc -l) -gt 0 ]; then echo "Need to run 'make create-api-docs' to generate the new Python API documentation and commit the documentation to the repository."; exit 1; fi
doc-build-check-upload:
name: Check documentation can build and if the main branch upload build
runs-on: ubuntu-latest
needs: doc-generated-check
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Node JS
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'yarn'
cache-dependency-path: './docs/yarn.lock'
- name: Test Build
working-directory: ./docs
run: |
yarn install --frozen-lockfile
yarn build
- name: Upload build
if: github.ref_name == 'main'
uses: actions/upload-pages-artifact@v4
with:
path: ./docs/build
deploy:
name: Deploy to GitHub Pages
needs: doc-build-check-upload
runs-on: ubuntu-latest
if: github.ref_name == 'main'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy pages to GitHub
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action