Update Makefile and CLAUDE.md for the uv/GitHub Actions build #8
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: Build and Deploy | |
| on: | |
| push: | |
| branches: ['**'] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: 'release' | |
| use-public-rspm: true | |
| - name: Install R packages | |
| run: R -e "install.packages(c('ggplot2', 'mgcv'))" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Install Python dependencies | |
| run: uv sync | |
| - name: Install Chrome for Kaleido | |
| run: uv run kaleido_get_chrome | |
| - name: Run tests | |
| run: uv run pytest tests/ -v | |
| - name: Execute notebook | |
| run: uv run jupyter nbconvert --to notebook --execute Examples.ipynb --output Examples.build.ipynb | |
| - name: Render site | |
| run: uv run python render.py Examples.build.ipynb | |
| - name: Deploy to Netlify (Production) | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| uses: nwtgck/actions-netlify@v3 | |
| with: | |
| publish-dir: ./web | |
| production-deploy: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: "Deploy from GitHub Actions - ${{ github.event.head_commit.message }}" | |
| enable-pull-request-comment: false | |
| enable-commit-comment: false | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - name: Deploy to Netlify (Preview) | |
| if: github.ref != 'refs/heads/master' | |
| uses: nwtgck/actions-netlify@v3 | |
| with: | |
| publish-dir: ./web | |
| production-deploy: false | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: "Preview deploy from GitHub Actions" | |
| enable-pull-request-comment: true | |
| enable-commit-comment: false | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - name: Upload build artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-build | |
| path: web/ | |
| retention-days: 7 |