Skip to content

Build (master)

Build (master) #555

Workflow file for this run

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}