-
Notifications
You must be signed in to change notification settings - Fork 59
104 lines (87 loc) · 3.01 KB
/
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
name: Build
on:
pull_request:
branches:
- main
jobs:
Prepare:
name: Setup environment
if: ${{ github.event.label.name != 'no-build' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repsitory
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 1
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.7.17
- name: Cache Python packages
id: cache-python
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}$-${{ hashFiles('requirements.txt') }}
- name: Install MegEngine and Python dependencies
if: steps.cache-python.outputs.cache-hit != 'true'
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt
pip install megengine -f https://megengine.org.cn/whl/mge.html
Generate:
name: Build HTML files
needs: Prepare
runs-on: ubuntu-latest
strategy:
matrix:
language: ["zh_CN", "en"]
steps:
# TODO: This step is only working for zh_CN website now (it should always be on ideally).
# Because there are still lots of warnings should be fixed in en site.
# They were caused by machine translation generated contents and need to be fixed in the future.
# Finally, any warning case should break the building process.
- name: Set env for Sphinx build args
if: ${{ contains(matrix.language, 'zh') }}
run: |
echo "buildExtraArgs=--keep-going" >> $GITHUB_ENV
- name: Checkout repsitory
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 1
submodules: recursive
- name: LFS - Create hash files
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: LFS - Restore cache
uses: actions/cache@v3
id: lfs-cache
with:
path: .git/lfs
key: ${{ hashFiles('.lfs-assets-id') }}
- name: LFS - pull missed files
run: git lfs pull
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.7.17
- name: Get cached Python packages
id: cache-python
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}$-${{ hashFiles('requirements.txt') }}
- name: Install pandoc and other dependencies
run: sudo apt install -y pandoc graphviz
- name: Generate HTML files
run: |
make html SPHINXOPTS="-j auto -D language=${{ matrix.language }} ${{ env.buildExtraArgs }}"
mv build/html ${{ matrix.language }}
tar czf ${{ matrix.language }}.tgz ${{ matrix.language }}
- name: Upload aritifacts
uses: actions/upload-artifact@v2
with:
name: HTML
path: ${{ matrix.language }}.tgz