-
Notifications
You must be signed in to change notification settings - Fork 20
99 lines (94 loc) · 3.53 KB
/
buildbook.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
name: buildbook
on: [push, pull_request]
env:
# Increase this value to reset cache
CONDA_CACHE_NUMBER: 0
PYDEVD_DISABLE_FILE_VALIDATION: 1 # disable warnings that debugger might not work using frozen (i.e. faster-to-load) modules. We'd expect debugging to be done outside of CI, so here it's probably fine to hide it.
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ipfs-version: [0.27.0]
defaults:
run:
shell: bash -l {0}
env:
IPFSSPEC_GATEWAYS: "http://127.0.0.1:8080"
steps:
- uses: actions/checkout@v3
- name: initialize conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: how_to_eurec4a
auto-activate-base: false
use-mamba: true
miniforge-variant: Mambaforge
miniforge-version: latest
- name: restore conda environment from cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{ hashFiles('environment.yml', 'requirements.txt') }}-${{ env.CONDA_CACHE_NUMBER }}
id: conda_cache
- name: install conda environment
run:
mamba env update -n how_to_eurec4a -f environment.yml
if: steps.conda_cache.outputs.cache-hit != 'true'
id: install_conda_env
- name: upload conda environment to cache
uses: actions/cache/save@v3
if: steps.install_conda_env.outcome == 'success'
with:
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{ hashFiles('environment.yml', 'requirements.txt') }}-${{ env.CONDA_CACHE_NUMBER }}
- name: Install local ipfs node
run: |
sudo apt-get update
sudo apt-get install -y wget curl jq
bash <(curl https://raw.githubusercontent.com/eurec4a/ipfs_tools/main/install_and_run_ipfs.sh) ${{ matrix.ipfs-version }}
- name: setting up notebook execution cache
uses: actions/cache/restore@v3
with:
path: |
how_to_eurec4a/_build/.jupyter_cache
key: notebooks-${{ runner.os }}-${{ hashFiles('environment.yml', 'requirements.txt') }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
notebooks-${{ runner.os }}-${{ hashFiles('environment.yml', 'requirements.txt') }}-${{ github.run_id }}-
notebooks-${{ runner.os }}-${{ hashFiles('environment.yml', 'requirements.txt') }}-
- name: build book
run: |
conda info
jupyter-book build -W -n --keep-going how_to_eurec4a
- name: save execution cache
uses: actions/cache/save@v3
if: always()
with:
path: |
how_to_eurec4a/_build/.jupyter_cache
key: notebooks-${{ runner.os }}-${{ hashFiles('environment.yml', 'requirements.txt') }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: html
path: |
how_to_eurec4a/_build/html
publish:
needs: build
if: "always() && github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'eurec4a'"
runs-on: ubuntu-latest
steps:
- name: Download compiled book
uses: actions/download-artifact@v3
with:
name: html
path: html
- name: Publish book on github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: html
cname: howto.eurec4a.eu