-
Notifications
You must be signed in to change notification settings - Fork 24
113 lines (91 loc) · 3.19 KB
/
cd-build.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
name: CD
on:
push:
branches:
- master
- main
jobs:
coverage:
name: Deploy Coverage Results
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check Python Version
run: python --version
- name: Install Package Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r develop.txt
- name: Install PySAP
run: python -m pip install .
- name: Run Tests
run: python -m pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: unittests
api:
name: Deploy API Documentation
needs: coverage
runs-on: ubuntu-latest
if: success()
env:
gh_root: https://github.com/CEA-COSMIC/
tag_path: /archive/refs/tags/
sphinx_opts: -t docs/_templates -feTMo docs/source
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check Python Version
run: python --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pandoc
python -m pip install -r docs/requirements.txt
python -m pip install .
- name: Download plug-ins
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')"
plugin_version="$(echo ${_plugin} | awk -F== '{print $2}')"
wget ${gh_root}${plugin_name}${tag_path}${plugin_version}.tar.gz -O ${plugin_name}.tar.gz
done < plugins.txt
for file in *.tar.gz; do tar xzf "$file"; done
rm *.tar.gz
- name: Extract plug-in examples
if: ${{ inputs.build_examples }}
run: |
while read _plugin; do
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')"
cp -r ${plugin_name}-*/examples examples/${plugin_name} || echo "Warning: no examples found for ${plugin_name}"
done < plugins.txt
- name: Build PySAP source files
run: sphinx-apidoc ${sphinx_opts} pysap
- name: Build plug-in source files
if: ${{ inputs.build_plugins }}
run: |
while read _plugin; do
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')"
package_name="$(echo ${plugin_name} | awk -F- '{print $2}')"
sphinx-apidoc ${sphinx_opts} ${plugin_name}-*/${package_name}
done < plugins.txt
- name: Build API documentation
run: sphinx-build -E docs/source docs/_build
- name: Deploy API documentation
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build