-
Notifications
You must be signed in to change notification settings - Fork 19
67 lines (60 loc) · 2.45 KB
/
sphinx-link-checker.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
name: sphinx-link-checker
on:
workflow_call:
inputs:
environment_name:
description: 'Name of conda environment to activate'
required: false
default: 'pythia'
type: string
environment_file:
description: 'Name of conda environment file'
required: false
default: 'environment.yml'
type: string
path_to_source:
description: 'Location of the sphinx source relative to repo root'
required: false
default: './'
type: string
use_cached_environment:
description: 'Flag for whether we should attempt to retrieve a previously cached environment.'
required: false
default: 'true'
type: string # had a lot of trouble with boolean types, see https://github.com/actions/runner/issues/1483
jobs:
link-checker:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
python-version: "3.10" # binderbot is failing with python 3.11
activate-environment: ${{ inputs.environment_name }}
- name: Set cache date
if: inputs.use_cached_environment == 'true'
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- uses: actions/cache@v3
if: inputs.use_cached_environment == 'true'
with:
path: /usr/share/miniconda3/envs/${{ inputs.environment_name }}
# This should create a key that looks like 'linux-64-conda-environment.yml-[HASH]-DATE'
# Logic inspired by https://dev.to/epassaro/caching-anaconda-environments-on-github-actions-2d08
key: ${{ format('linux-64-conda-{0}-{1}-{2}', inputs.environment_file, hashFiles(format('{0}', inputs.environment_file)), env.DATE )}}
id: cache
- name: Update execution environment
if: |
(inputs.use_cached_environment != 'true'
|| steps.cache.outputs.cache-hit != 'true')
run: |
conda env update -n ${{ inputs.environment_name }} -f ${{ inputs.environment_file }}
conda install -c conda-forge sphinxcontrib-applehelp=1.0.4 sphinxcontrib-devhelp=1.0.2 sphinxcontrib-htmlhelp=2.0.1 sphinxcontrib-qthelp=1.0.3 sphinxcontrib-serializinghtml=1.1.5
- name: Check external links
run: |
cd ${{ inputs.path_to_source }}
make linkcheck