Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 28 additions & 73 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
HAS_CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }}

steps:
- name: Checkout code
Expand All @@ -17,94 +19,47 @@ jobs:
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3'
r-version: 'release'
use-public-rspm: true

- name: Install R packages
run: |
R -e "install.packages(c('ggplot2', 'mgcv'), repos='https://cran.rstudio.com/')"

- name: Verify R installation
run: |
echo "R_HOME=$R_HOME"
R --version
R -e "library(ggplot2); library(mgcv); cat('R packages loaded successfully\n')"

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
run: R -e "install.packages(c('ggplot2', 'mgcv'))"

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install Python dependencies
run: |
uv pip install -r requirements.txt --system
run: uv sync

- name: Install Chrome for Kaleido
run: |
uv run kaleido_get_chrome

- name: Verify Python packages
run: |
python -c "import pandas, plotly, seaborn, plotnine, altair, rpy2; print('Python packages imported successfully')"

- name: Setup Firefox for Selenium
uses: browser-actions/setup-firefox@v1

- name: Install geckodriver
run: |
wget -q https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
tar -xzf geckodriver-v0.34.0-linux64.tar.gz
sudo mv geckodriver /usr/local/bin/
geckodriver --version

- name: Setup Xvfb (virtual display)
run: |
sudo apt-get update
sudo apt-get install -y xvfb
run: uv run kaleido_get_chrome

- name: Run tests
run: |
xvfb-run -a python -m pytest tests/ -v
env:
R_HOME: /opt/R/4.3.3/lib/R
run: uv run pytest tests/ -v

- name: Execute notebook
run: uv run jupyter nbconvert --to notebook --execute Examples.ipynb --output Examples.build.ipynb

- name: Build site
run: |
xvfb-run -a make travis
env:
R_HOME: /opt/R/4.3.3/lib/R
- 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
- 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:
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 }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy web --project-name=pythonplot --branch=main

- name: Deploy to Netlify (Preview)
if: github.ref != 'refs/heads/master'
uses: nwtgck/actions-netlify@v3
- name: Deploy to Cloudflare Pages (Preview)
if: github.ref != 'refs/heads/master' && env.HAS_CF_TOKEN == 'true'
uses: cloudflare/wrangler-action@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 }}
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()
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ web/img/plots/
Examples.*.ipynb
.setup_done
.venv/
uv.lock
# Local Netlify folder
.netlify
__pycache__/
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .travis/authenticate_plotly.py

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/install_conda.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .travis/invalidate_cloudfront.py

This file was deleted.

2 changes: 0 additions & 2 deletions .travis/orca

This file was deleted.

Loading
Loading