From 6ebfe404988824c4223e560b539ca4e4b777505d Mon Sep 17 00:00:00 2001
From: Shenghang Tsai <jackalcooper@gmail.com>
Date: Fri, 30 Jul 2021 14:49:57 +0800
Subject: [PATCH] Mv clangtidy to simple ci (#5667)

* mv clang tidy to simple ci

* rm timeout

* refei

* refein

Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
---
 .github/workflows/simple.yml | 50 ++++++++++++++++++++++++++++++++++--
 .github/workflows/test.yml   | 43 -------------------------------
 2 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/.github/workflows/simple.yml b/.github/workflows/simple.yml
index 7072f4024..1967f15df 100644
--- a/.github/workflows/simple.yml
+++ b/.github/workflows/simple.yml
@@ -22,12 +22,58 @@ jobs:
         uses: styfle/cancel-workflow-action@0.9.0
         with:
           access_token: ${{ github.token }}
+
+  static_analysis_with_clang:
+    name: Static analysis with clang
+    runs-on: ubuntu-20.04
+    if: github.ref == 'refs/heads/master' || (github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot') && contains(github.event.pull_request.labels.*.name, 'need-simple-ci'))
+    steps:
+      - name: Check out OneFlow
+        uses: actions/checkout@v2
+        with:
+          ref: ${{ github.event.pull_request.head.ref }}
+          repository: ${{github.event.pull_request.head.repo.full_name}}
+      - name: Install dependencies
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y libopenblas-dev nasm python3-pip ninja-build
+      - name: Download OneFlow custom clang-tidy
+        run: |
+          wget https://github.com/oneflow-inc/llvm-project/releases/download/latest/clang-tidy
+          wget https://raw.githubusercontent.com/oneflow-inc/llvm-project/maybe/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+          chmod +x clang-tidy run-clang-tidy.py
+      - name: Build third party libs and generate files
+        run: |
+          mkdir build
+          cd build
+          # clang-tidy has builtin includes, but doesn't work here
+          # https://clang.llvm.org/docs/LibTooling.html#builtin-includes
+          cmake .. -C ../cmake/caches/international/cpu.cmake \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DBUILD_TESTING=ON
+          cmake --build . -j$(nproc) --target of_git_version oneflow_deps generate_functional of_cfgobj generate_py_cfg
+      - name: Run Maybe-related checks by clang-tidy
+        run: |
+          cd build
+          rm CMakeCache.txt
+          cmake .. -C ../cmake/caches/international/cpu.cmake \
+            -DCMAKE_C_COMPILER=clang-12 \
+            -DCMAKE_CXX_COMPILER=clang++-12 \
+            -DCMAKE_CXX_FLAGS="-isystem /usr/lib/llvm-12/lib/clang/12.0.1/include/" \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DBUILD_TESTING=ON \
+            -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+          cd ..
+          ./run-clang-tidy.py -clang-tidy-binary ./clang-tidy -p build -quiet
+
   hosted:
     name: CPU-only
     if: github.ref == 'refs/heads/master' || (github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot') && contains(github.event.pull_request.labels.*.name, 'need-simple-ci'))
     runs-on: ${{ matrix.os }}
     needs: [cancel_previous]
-    timeout-minutes: 240
+    env:
+      CFLAGS: "-w"
+      CXXFLAGS: "-w"
     strategy:
       fail-fast: true
       max-parallel: 3
@@ -98,7 +144,7 @@ jobs:
       - name: Set environment variables (conda)
         if: matrix.test_suite == 'conda'
         run: |
-          conda env config vars set CXXFLAGS="-fPIC"
+          conda env config vars set CXXFLAGS="-w -fPIC"
         shell: bash -l {0}
       - name: Set environment variables
         run: |
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 69c66e5fb..24bbabf5f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -97,49 +97,6 @@ jobs:
         run: |
           python3 tools/check_src.py
 
-  static_analysis_with_clang:
-    name: Static analysis with clang
-    runs-on: ubuntu-20.04
-    if: github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot')
-    steps:
-      - name: Check out OneFlow
-        uses: actions/checkout@v2
-        with:
-          ref: ${{ github.event.pull_request.head.ref }}
-          repository: ${{github.event.pull_request.head.repo.full_name}}
-      - name: Install dependencies
-        run: |
-          sudo apt-get update
-          sudo apt-get install -y libopenblas-dev nasm python3-pip ninja-build
-      - name: Download OneFlow custom clang-tidy
-        run: |
-          wget https://github.com/oneflow-inc/llvm-project/releases/download/latest/clang-tidy
-          wget https://raw.githubusercontent.com/oneflow-inc/llvm-project/maybe/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
-          chmod +x clang-tidy run-clang-tidy.py
-      - name: Build third party libs and generate files
-        run: |
-          mkdir build
-          cd build
-          # clang-tidy has builtin includes, but doesn't work here
-          # https://clang.llvm.org/docs/LibTooling.html#builtin-includes
-          cmake .. -C ../cmake/caches/international/cpu.cmake \
-            -DCMAKE_BUILD_TYPE=Release \
-            -DBUILD_TESTING=ON
-          cmake --build . -j$(nproc) --target of_git_version oneflow_deps generate_functional of_cfgobj generate_py_cfg
-      - name: Run Maybe-related checks by clang-tidy
-        run: |
-          cd build
-          rm CMakeCache.txt
-          cmake .. -C ../cmake/caches/international/cpu.cmake \
-            -DCMAKE_C_COMPILER=clang-12 \
-            -DCMAKE_CXX_COMPILER=clang++-12 \
-            -DCMAKE_CXX_FLAGS="-isystem /usr/lib/llvm-12/lib/clang/12.0.1/include/" \
-            -DCMAKE_BUILD_TYPE=Release \
-            -DBUILD_TESTING=ON \
-            -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-          cd ..
-          ./run-clang-tidy.py -clang-tidy-binary ./clang-tidy -p build -quiet
-
   wait_for_gpu_slot:
     name: Wait for GPU slots
     runs-on: [self-hosted, scheduler]
-- 
GitLab