forked from nilearn/nilearn
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 4.69 KB
/
release-docs.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
---
name: BuildReleaseDocs
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This will run automatically when a release is published
release:
types: [published]
env:
BROWSER: /usr/bin/firefox
DISPLAY: :99.0
NILEARN_DATA: /home/runner/work/nilearn/nilearn/nilearn_data
MIN_PYTHON_VERSION: '3.9'
jobs:
# this job gets the data required for the build and passes via cache to the build_doc job
get_data:
# This prevents this workflow from running on a fork.
# To test this workflow on a fork, uncomment the following line.
if: github.repository == 'nilearn/nilearn'
runs-on: ubuntu-latest
timeout-minutes: 360
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout nilearn
uses: actions/checkout@v4
# Set up environment
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install packages
run: |
python -m pip install --user --upgrade pip setuptools
python -m pip install .
- name: Get cache from a previous attempts of this run number
uses: actions/cache@v4
with:
path: nilearn_data
key: data_cache-${{ github.workflow }}_ref-${{ github.ref }}_run-${{ github.run_number }}_attempt-${{ github.run_attempt }}
restore-keys: |
data_cache-${{ github.workflow }}_ref-${{ github.ref }}_run-${{ github.run_number }}
- name: Get data
run: |
echo "Download data required for building doc"
python doc/get_data_examples.py full
- name: Save cache to pass to build_docs job
uses: actions/cache/save@v4
if: always()
with:
path: /home/runner/work/nilearn/nilearn/nilearn_data
key: data_cache-${{ github.workflow }}_ref-${{ github.ref }}_run-${{ github.run_number }}_attempt-${{ github.run_attempt }}
release-docs:
if: github.repository == 'nilearn/nilearn'
needs: [get_data]
runs-on: ubuntu-latest
timeout-minutes: 360
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout nilearn
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "${{ secrets.ACTIONS_SSH_DEPLOY }}" > ~/.ssh/github_actions
chmod 600 ~/.ssh/github_actions
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add ~/.ssh/github_actions
- name: Install apt packages
run: |
sudo -E apt-get -yq update
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install \
dvipng texlive-latex-base texlive-latex-extra
- name: Get data from the get_data job
uses: actions/cache@v4
with:
path: /home/runner/work/nilearn/nilearn/nilearn_data
key: data_cache-${{ github.workflow }}_ref-${{ github.ref }}_run-${{ github.run_number }}_attempt-${{ github.run_attempt }}
restore-keys: |
data_cache-${{ github.workflow }}_ref-${{ github.ref }}_run-${{ github.run_number }}
# Set up and launch a virtual browser needed for one example to run
# without stalling the job. The example launches an html in the browser.
- name: Set up display server for virtual browser
run: Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Install tox
run: python -m pip install pip tox
- name: Build docs
# We let tox handle creating virtual env and install dependencies.
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub actions"
set -o pipefail
export VERSIONTAG=$(git describe --tags --abbrev=0)
tox run \
--colored yes \
--list-dependencies \
-e doc -- install