ci.yml 3.8 KB
Newer Older
1 2 3 4 5 6
name: CI

on:
  push:
    branches: [master, try-import]
  pull_request:
H
huangxinda 已提交
7 8 9 10 11

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

12
jobs:
13 14 15 16 17 18 19
  check-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2.1.0
20 21 22 23 24
      - name: Check commit
        if: ${{ github.event.pull_request }}
        run: |
          yarn add @commitlint/config-conventional @commitlint/cli
          yarn commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD
25

26 27
  cpu-test:
    runs-on: self-hosted
H
huangxinda 已提交
28
    needs: [check-commit]
29
    container:
H
huangxinda 已提交
30
      image: mcd.io/mcd-apps/megengine-ci:v1
31 32
      env:
        FTP_URL_PREFIX: ${{ secrets.FTP_URL_PREFIX }}
33 34 35 36 37
    steps:
      - name: Checkout MegEngine
        uses: actions/checkout@v2
      - name: Checkout submodules
        run: |
H
huangxinda 已提交
38
          apt update&&apt install ninja-build
39 40 41 42 43
          ./third_party/prepare.sh
          ./third_party/install-mkl.sh
      - name: Build MegEngine
        run: ./ci/cmake.sh cpu
      - name: Python test
H
huangxinda 已提交
44 45 46 47 48 49
        run: |
          rm -rf imperative/python/megenginelite/
          cp -rf lite/pylite/megenginelite/ imperative/python/
          mkdir -p imperative/python/megenginelite/libs
          cp /tmp/build/cpu/lite/liblite_shared_whl.so imperative/python/megenginelite/libs/liblite_shared_whl.so
          ./ci/run_python_test.sh cpu
50 51 52 53
      - name: C++ test
        run: ./ci/run_cpp_test.sh cpu
  gpu-test:
    runs-on: self-hosted
H
huangxinda 已提交
54
    needs: [check-commit]
55
    container:
H
huangxinda 已提交
56
      image: mcd.io/mcd-apps/megengine-ci:v1
57
      volumes:
H
huangxinda 已提交
58
        - /usr/local/cuda-10.1-cudnn-7.6.3-trt-6.0.1.5-libs:/usr/local/cuda-10.1-cudnn-7.6.3-trt-6.0.1.5-libs
59 60 61
      options: --gpus all --shm-size 1g
      env:
        NCCL_LAUNCH_MODE: PARALLEL
62
        FTP_URL_PREFIX: ${{ secrets.FTP_URL_PREFIX }}
63 64 65 66 67
    steps:
      - name: Checkout MegEngine
        uses: actions/checkout@v2
      - name: Checkout submodules
        run: |
H
huangxinda 已提交
68
          apt update&&apt install ninja-build
69 70 71 72 73
          ./third_party/prepare.sh
          ./third_party/install-mkl.sh
      - name: Build MegEngine
        run: ./ci/cmake.sh cuda
      - name: Python test
H
huangxinda 已提交
74 75 76 77 78 79
        run: |
          rm -rf imperative/python/megenginelite/
          cp -rf lite/pylite/megenginelite/ imperative/python/
          mkdir -p imperative/python/megenginelite/libs
          cp /tmp/build/cuda/lite/liblite_shared_whl.so imperative/python/megenginelite/libs/liblite_shared_whl.so
          ./ci/run_python_test.sh cuda
80 81 82 83
      - name: C++ test
        run: ./ci/run_cpp_test.sh cuda
  auto-merge:
    if: ${{ github.ref == 'refs/heads/try-import' }}
H
huangxinda 已提交
84
    runs-on: self-hosted
85
    needs: [cpu-test, gpu-test]
H
huangxinda 已提交
86
    container:
H
huangxinda 已提交
87
      image: mcd.io/mcd-apps/megengine-ci:v1
88 89 90 91 92 93 94 95 96 97 98 99 100
    steps:
      - name: Checkout MegEngine
        uses: actions/checkout@v2
        with:
          fetch-depth: '0'
      - name: Merge with master
        run: |
          git config user.name "megvii-mge"
          git config user.email "megengine@megvii.com"
          git fetch origin master
          git checkout -b master origin/master
          git rebase try-import
          git push
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
  send-dingding:
    runs-on: ubuntu-latest
    needs: [cpu-test, gpu-test]
    if: ${{ always() && github.ref == 'refs/heads/try-import' && (needs.cpu-test.result == 'failure' || needs.gpu-test.result == 'failure' ) }}
    steps:
      - name: run
        uses: zcong1993/actions-ding@master
        with:
          dingToken: ${{ secrets.DINGDING_TOKEN }}
          body: |
            {
              "msgtype": "link",
              "link": {
                  "text": "Workflow ${{ github.run_id }} Failed",
                  "title": "Action Alert",
                  "picUrl": "",
                  "messageUrl": "https://github.com/MegEngine/MegEngine/actions/runs/${{ github.run_id }}"
              }
            }