-
Notifications
You must be signed in to change notification settings - Fork 59
152 lines (135 loc) · 5 KB
/
build-dev.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build (master)
on:
pull_request:
branches:
- dev
schedule:
- cron: '0 0/24 * * *'
jobs:
Flow:
name: Build master branches MegEngine and dev docs
runs-on: ubuntu-latest
steps:
- name: Checkout documentation repsitory
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 1
submodules: recursive
- name: Checkout MegEngine repsitory
uses: actions/checkout@v2
with:
repository: MegEngine/MegEngine
path: megengine
ref: master
fetch-depth: 1
lfs: true
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@v2
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@v2
with:
python-version: 3.7
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install -r megengine/imperative/python/requires.txt
- name: Install pandoc and other dependencies
run: sudo apt install -y pandoc graphviz
- name: Build MegEngine
run: |
cd ${GITHUB_WORKSPACE}/megengine
./third_party/prepare.sh
./third_party/install-mkl.sh
cmake -S . -B build -DMGE_WITH_DISTRIBUTED=OFF -DMGE_WITH_CUDA=OFF -DMGE_WITH_LITE=ON
make -C build -j$(($(nproc) * 2))
make -C build -j$(($(nproc) * 2)) develop
- name: Generate HTML files
run: |
export PYTHONPATH=${GITHUB_WORKSPACE}/megengine/imperative/python:$PYTHONPATH
export PYTHONPATH=${GITHUB_WORKSPACE}/megengine/lite/pylite:$PYTHONPATH
export LITE_LIB_PATH=${GITHUB_WORKSPACE}/megengine/build/lite/liblite_shared.so
export MGE_DOC_MODE="FULL"
cd ${GITHUB_WORKSPACE}
make html
mv build/html zh_CN
tar czf zh_CN.tgz zh_CN
- name: Upload aritifacts
uses: actions/upload-artifact@v2
with:
name: HTML_zh_CN
path: zh_CN.tgz
- name: Generate HTML files - Message WebHook
if: ${{ failure() }}
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_BOT_TOKEN }}
body: |
{
"msgtype": "link",
"link": {
"title": "Oops! 文档构建失败...",
"text": "请检查任何 Warning 或 Error 信息 :(",
"picUrl": "",
"messageUrl": "https://github.com/MegEngine/Documentation/actions/runs/${{ github.run_id }}"
}
}
# - name: API Coverage Test
# id: api-coverage
# run: |
# export PYTHONPATH=${GITHUB_WORKSPACE}/megengine/imperative/python:$PYTHONPATH
# export PYTHONPATH=${GITHUB_WORKSPACE}/megengine/lite/pylite:$PYTHONPATH
# export LITE_LIB_PATH=${GITHUB_WORKSPACE}/megengine/build/lite/liblite_shared.so
# export MGE_DOC_MODE="FULL"
# cd ${GITHUB_WORKSPACE}
# python3 ./scripts/coverage.py
# - name: API Coverage Test Failure - Message WebHook
# if: ${{ failure() }}
# uses: zcong1993/actions-ding@master
# with:
# dingToken: ${{ secrets.DING_TALK_BOT_TOKEN }}
# body: |
# {
# "msgtype": "link",
# "link": {
# "title": "Oops! 文档构建失败...",
# "text": "未能通过 API 覆盖率测试 :(",
# "picUrl": "",
# "messageUrl": "https://github.com/MegEngine/Documentation/actions/runs/${{ github.run_id }}"
# }
# }
upload-dev-docs:
runs-on: self-hosted
needs: [Flow]
container:
image: mcd.io/mcd-apps/megengine-ci:v1
env:
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }}
OSS_SECRET_ACCESS_KEY: ${{ secrets.OSS_SECRET_ACCESS_KEY }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
steps:
- name: Download Aritifacts
uses: actions/download-artifact@v3
with:
name: HTML_zh_CN
- name: Upload Docs
run: |
python3 -m pip install awscli boto3
aws --version || export PATH=/github/home/.local/bin:$PATH
aws configure set aws_access_key_id "${OSS_ACCESS_KEY_ID}"
aws configure set aws_secret_access_key "${OSS_SECRET_ACCESS_KEY}"
cd /__w/Documentation/Documentation
tar zxvf zh_CN.tgz
aws --endpoint-url=${OSS_ENDPOINT} s3 rm --recursive ${OSS_BUCKET}
aws --endpoint-url=${OSS_ENDPOINT} s3 cp --recursive zh_CN ${OSS_BUCKET}