Rewrite dated intro commentary; fill matplotlib and seaborn coverage #41
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 | |
| env: | |
| HAS_CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }} | |
| 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 Cloudflare Pages (Production) | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' && env.HAS_CF_TOKEN == 'true' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy web --project-name=pythonplot --branch=main | |
| - name: Deploy to Cloudflare Pages (Preview) | |
| if: github.ref != 'refs/heads/master' && env.HAS_CF_TOKEN == 'true' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy web --project-name=pythonplot --branch=${{ github.head_ref || github.ref_name }} | |
| - name: Upload build artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-build | |
| path: web/ | |
| retention-days: 7 |