CRAN 网络 #86
Workflow file for this run
This file contains 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
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
name: Book-MacOS | |
jobs: | |
build-deploy: | |
runs-on: macos-13 | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CMDSTAN_VERSION: "2.33.1" | |
RETICULATE_PYTHON_ENV: /opt/.virtualenvs/r-tensorflow | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
version: 1.4.527 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
r-version: '4.3.2' | |
extra-repositories: 'https://mc-stan.org/r-packages https://inla.r-inla-download.org/R/stable https://grantmcdermott.r-universe.dev' | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
- name: Install TinyTeX | |
uses: r-lib/actions/setup-tinytex@v2 | |
env: | |
# install full prebuilt version | |
TINYTEX_INSTALLER: TinyTeX | |
- name: Setup CmdStan | |
run: | | |
curl -fLo cmdstan-${CMDSTAN_VERSION}.tar.gz https://github.com/stan-dev/cmdstan/releases/download/v${CMDSTAN_VERSION}/cmdstan-${CMDSTAN_VERSION}.tar.gz | |
sudo mkdir -p /opt/cmdstan/ | |
sudo chown -R $(whoami):staff /opt/cmdstan/ | |
tar -xzf cmdstan-${CMDSTAN_VERSION}.tar.gz -C /opt/cmdstan/ | |
make build -C /opt/cmdstan/cmdstan-${CMDSTAN_VERSION} | |
rm cmdstan-${CMDSTAN_VERSION}.tar.gz | |
- name: Install Fonts From System | |
run: | | |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | |
brew install optipng jags virtualenv | |
brew install --cask xquartz | |
brew tap homebrew/cask-fonts | |
brew install --cask font-noto-sans-cjk-sc font-noto-serif-cjk-sc | |
fc-list | sort | |
- name: Setup Python | |
run: | | |
sudo mkdir -p /opt/.virtualenvs/r-tensorflow | |
sudo chown -R $(whoami):staff /opt/.virtualenvs/r-tensorflow | |
virtualenv -p /usr/bin/python3 $RETICULATE_PYTHON_ENV | |
source $RETICULATE_PYTHON_ENV/bin/activate | |
pip3 install -r docker/requirements.txt | |
deactivate | |
- name: Install LaTeX packages | |
run: | | |
if(!require('tinytex')) install.packages('tinytex') | |
tinytex::tlmgr_install(readLines("docker/texlive.txt")) | |
tinytex::tl_pkgs() | |
tikzDevice::tikzTest("m", engine = "xetex") | |
tikzDevice::tikzTest("$\\sin(x^2/2 - y^2/4 + 3) \\cos(2 x + 1 - \\exp(y))$") | |
shell: Rscript {0} | |
- name: Reinstall R packages from source | |
run: | | |
install.packages(c("Matrix", "MatrixModels", "rjags", "lme4", "TMB", "glmmTMB"), repos = "https://cran.r-project.org/", type = "source") | |
shell: Rscript {0} | |
- name: Render Book | |
run: | | |
source $RETICULATE_PYTHON_ENV/bin/activate | |
quarto check | |
quarto render --to html | |
shell: bash | |
env: | |
RETICULATE_PYTHON_ENV: /opt/.virtualenvs/r-tensorflow | |
RETICULATE_PYTHON: /opt/.virtualenvs/r-tensorflow/bin/python | |
CMDSTAN: /opt/cmdstan/cmdstan-${{ env.CMDSTAN_VERSION }} | |
- name: Deploy to Github Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
git-config-name: GitHub Actions | |
git-config-email: actions@github.com | |
branch: gh-pages | |
folder: _book | |
clean: true | |
- name: Upload book folder for debug | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Upload Book | |
path: _book |