-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (116 loc) · 4.52 KB
/
build-docs-on-pr.yml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Build docs on PR
on: pull_request
jobs:
build-html-and-preview:
runs-on: ubuntu-latest
# Use the following if you want to run only on devel
# if: github.ref == 'refs/heads/devel'
steps:
# Cache npm modules
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-npm-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ env.cache-name }}-
${{ runner.os }}-npm-
# The following installs the repo and cd's to it
- name: Checkout repo
uses: actions/checkout@v2
# Install System Requirements
# install requirements for docs, pyshtools
- name: System Requirements
run: ifconfig -a
&& sudo apt-get install doxygen python3-sphinx
&& sudo apt-get install libblas-dev liblapack-dev g++ gfortran libfftw3-dev tcsh
# Install Conda Requirements
- name: Conda Requirements
run: conda config --append channels conda-forge
&& conda config --set channel_priority flexible
&& conda env --name avni-doc create --file docs/conda/environment_doc.yml
&& conda activate avni-doc
&& pip install -e .
# && pip3 install sphinx_rtd_theme
# && pip3 install sphinx-sitemap
# && pip3 install pydata_sphinx_theme
# && pip3 install numpydoc
# && pip3 install -U Sphinx
# && pip3 install sphinxcontrib-apidoc
# && pip3 install sphinxcontrib-bibtex
# && pip3 install sphinx-gallery
# && pip3 install numpy pygments
# && pip3 install recommonmark
# Caching based on https://stackoverflow.com/a/57958803
- name: Cache Tex dependencies
id: cache-tex
uses: actions/cache@v3
with:
path: |
/tmp/texlive
$HOME/.texlive
key: ${{ runner.os }}-tex-cache-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-tex-cache-${{ env.cache-name }}-
${{ runner.os }}-tex-cache-
# Install TexLive
# https://github.com/PHPirates/travis-ci-latex-pdf#instructions-for-building-with-pdflatexlualatexlatexmkxelatextexliveonflyetc-and-tex-live
- name: Install Tex dependencies
run: |
source docs/texlive/texlive_install.sh
echo "/tmp/texlive/bin/x86_64-linux" >> $GITHUB_PATH
- name: Build html docs
run: cd docs
&& sphinx-apidoc -o api/ ../avni
&& make html
&& cd _build/html
&& mkdir ../../../public
&& cp -r * ../../../public
&& cd ../../..
# Remove API for latex document, it is broken
# TODO: Fix this. Currently we create too many nested
# lists in the API. Is this a sphinx problem or AVNI problem?
- name: Build pdf docs
run: cd docs
&& rm -r api
&& make latex
&& cd _build/latex
&& texliveonfly AVNI.tex
&& ls /tmp/texlive/bin/x86_64-linux
&& make
&& cd ../../..
# Deploy to Firebase
- name: Deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AVNI_EC064 }}'
projectId: avni-ec064
channelId: 'pr-${{ github.event.number }}'
expires: 7d
# Slack notification
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/[email protected]
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nTemporary ReadtheDocs: https://avni-ec064--pr-${{ github.event.number }}.web.app'"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK