Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mv clangtidy to simple ci #5667

Merged
merged 5 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down