Skip to content

Commit edb7a82

Browse files
tdhopperclaude
andcommitted
Migrate CI/CD from Travis CI to GitHub Actions
Add .github/workflows/deploy.yml with: - R 4.3 setup via r-lib/actions - Python 3.11 setup - uv for dependency installation - Firefox/geckodriver for selenium - xvfb for headless rendering - pytest test execution - Netlify deployment: - Production: master branch - Preview: other branches Required GitHub secrets: - NETLIFY_AUTH_TOKEN - NETLIFY_SITE_ID This modernizes CI from deprecated Travis CI to GitHub Actions with improved caching and faster builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bf5b5f4 commit edb7a82

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup R
18+
uses: r-lib/actions/setup-r@v2
19+
with:
20+
r-version: '4.3'
21+
22+
- name: Install R packages
23+
run: |
24+
R -e "install.packages(c('ggplot2', 'mgcv'), repos='https://cran.rstudio.com/')"
25+
26+
- name: Verify R installation
27+
run: |
28+
echo "R_HOME=$R_HOME"
29+
R --version
30+
R -e "library(ggplot2); library(mgcv); cat('R packages loaded successfully\n')"
31+
32+
- name: Setup Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11'
36+
37+
- name: Install uv
38+
run: |
39+
curl -LsSf https://astral.sh/uv/install.sh | sh
40+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
41+
42+
- name: Install Python dependencies
43+
run: |
44+
uv pip install -r requirements.txt --system
45+
46+
- name: Verify Python packages
47+
run: |
48+
python -c "import pandas, plotly, seaborn, plotnine, altair, rpy2; print('Python packages imported successfully')"
49+
50+
- name: Setup Firefox for Selenium
51+
uses: browser-actions/setup-firefox@v1
52+
53+
- name: Install geckodriver
54+
run: |
55+
wget -q https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
56+
tar -xzf geckodriver-v0.34.0-linux64.tar.gz
57+
sudo mv geckodriver /usr/local/bin/
58+
geckodriver --version
59+
60+
- name: Setup Xvfb (virtual display)
61+
run: |
62+
sudo apt-get update
63+
sudo apt-get install -y xvfb
64+
65+
- name: Run tests
66+
run: |
67+
xvfb-run -a python -m pytest tests/ -v
68+
env:
69+
R_HOME: /opt/R/4.3.3/lib/R
70+
71+
- name: Build site
72+
run: |
73+
xvfb-run -a make travis
74+
env:
75+
R_HOME: /opt/R/4.3.3/lib/R
76+
77+
- name: Deploy to Netlify (Production)
78+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
79+
uses: nwtgck/actions-netlify@v3
80+
with:
81+
publish-dir: ./web
82+
production-deploy: true
83+
github-token: ${{ secrets.GITHUB_TOKEN }}
84+
deploy-message: "Deploy from GitHub Actions - ${{ github.event.head_commit.message }}"
85+
enable-pull-request-comment: false
86+
enable-commit-comment: false
87+
env:
88+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
89+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
90+
91+
- name: Deploy to Netlify (Preview)
92+
if: github.ref != 'refs/heads/master'
93+
uses: nwtgck/actions-netlify@v3
94+
with:
95+
publish-dir: ./web
96+
production-deploy: false
97+
github-token: ${{ secrets.GITHUB_TOKEN }}
98+
deploy-message: "Preview deploy from GitHub Actions"
99+
enable-pull-request-comment: true
100+
enable-commit-comment: false
101+
env:
102+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
103+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
104+
105+
- name: Upload build artifacts
106+
if: always()
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: site-build
110+
path: web/
111+
retention-days: 7

0 commit comments

Comments
 (0)