-
Notifications
You must be signed in to change notification settings - Fork 18
101 lines (87 loc) · 3.1 KB
/
quarto-book-macos.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
on:
push:
branches: main
pull_request:
branches: main
name: Book-MacOS
jobs:
build-deploy:
runs-on: macos-14
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
PANDOC_VERSION: "3.1.11"
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.550
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: '4.3.2'
extra-repositories: 'https://grantmcdermott.r-universe.dev'
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Install TinyTeX
uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX
- 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
python -m spacy download en_core_web_sm
python -m spacy download zh_core_web_sm
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
shell: bash
env:
RETICULATE_PYTHON_ENV: /opt/.virtualenvs/r-tensorflow
RETICULATE_PYTHON: /opt/.virtualenvs/r-tensorflow/bin/python
- name: Deploy book to bookdown.org
if: github.event_name == 'push'
env:
CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_TOKEN }}
CONTENT_ID: ${{ secrets.RSC_BOOKDOWN_APP_ID }}
run: |
Rscript '_deploy.R'
shell: bash
- name: Upload book folder for debug
if: failure()
uses: actions/upload-artifact@v3
with:
name: Upload Book
path: _book