-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (117 loc) · 5.49 KB
/
doc-deploy.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
129
130
131
132
# This workflow will build fractalshades documentation and deploy it to repo
# `fractalshades-doc`
name: doc-deploy
# Controls when the workflow will run
on:
# Triggers the workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "deploy_doc"
deploy_doc:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"] # , 3.8]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Prepare install dependencies
run: |
sudo apt-get update
pip install --upgrade pip
- name: Prepare GUI
run: |
echo "Prepare GUI for pyQt6"
pip install pyQt6
# See
# https://github.com/pytest-dev/pytest-qt/issues/396
# https://github.com/pytest-dev/pytest-qt/pull/295/files
# https://github.com/konserw/mre/blob/master/.github/workflows/linux.yml
# https://moderngl.readthedocs.io/en/5.6.3/techniques/headless_ubuntu_18_server.html
sudo apt-get install xvfb mesa-utils libegl1-mesa
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install --reinstall libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0
- name: Install GMP MPFR MPC needed for gmpy2
run: |
sudo apt-get install libgmp-dev
sudo apt-get install libmpfr-dev
sudo apt-get install libmpc-dev
- name: Install Latex
run: |
sudo apt-get install dvipng
sudo apt-get install texlive
sudo apt-get install texlive-latex-extra
- name: Install python modules build & test dependencies
run: |
pip install --upgrade pip
pip install --upgrade build
pip install flake8 pytest
- name: install Fractalshades from current commit
run: |
# Step 1 build
python3 -m build
# Step 2 install
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python3 -m pip install fractalshades --user --force-reinstall --no-deps --no-index --find-links dist
- name: install dependencies to build the documentation
run: |
python -m pip install sphinx sphinx_rtd_theme sphinx-gallery numpydoc matplotlib sphinxcontrib-bibtex sphinxcontrib-youtube
# Dependencies for fractalshades.movie
python -m pip install av scipy
- name: Build the doc and publish it
run: |
echo "###################################"
echo "Download previous status of examples from repo fractalshades-doc"
build_dir=`pwd`
deploy_dir=`mktemp -d`
pushd "${deploy_dir}"
git config --global user.email "[email protected]"
git config --global user.name "GBillotey"
git clone "https://token:${{ secrets.DOC_PUSH_TOKEN }}@github.com/${{ github.repository }}-doc.git" .
# Here we check that doc-latest branch exists, and if yes, copy the files before building
# https://stackoverflow.com/questions/8223906/how-to-check-if-remote-branch-exists-on-a-given-remote-repository
if git ls-remote --heads origin doc-latest-data; then
echo 'Branch doc-latest-data exists in remote, copying files'
git checkout doc-latest-data
# Exclude git tracking files
rsync -av --exclude '.git' . "${build_dir}"/docs/examples/
else
echo 'Branch doc-latest-data does not exists in remote, create empty dir'
mkdir "${build_dir}"/docs/examples/
fi
popd
echo "###################################"
echo "Build the doc in build repo"
# Note: /!\ run with QT_QPA_PLATFORM=offscreen on a headless runner
make -C docs clean
QT_QPA_PLATFORM=offscreen make -C docs html
echo "###################################"
echo "Push the html doc to doc repository, branch doc-latest"
pushd "${deploy_dir}"
# don't bother maintaining history; just generate fresh in an orphan branch
git switch --orphan temp_data_branch
rsync -av "${build_dir}/docs/_build/html/" .
git add -A
git commit -m "Automatic triggered doc build - ${{ github.workflow }}"
git branch -m doc-latest
git push --force origin doc-latest
echo "###################################"
echo "Push the examples data to doc repository, branch doc-latest-data"
git switch --orphan temp_data_branch
rsync -av "${build_dir}/docs/examples/" .
git add -A
git commit -m "Automatic triggered doc build - ${{ github.workflow }}"
if git ls-remote --heads origin doc-latest-data; then
git branch -D doc-latest-data
fi
git branch -m doc-latest-data
git push --force origin doc-latest-data
popd