merge master #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Simple CI | |
on: | |
pull_request: | |
types: [review_requested] | |
branches: | |
- "*" | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
placeholder: | |
description: "placeholder, no effect" | |
required: false | |
concurrency: | |
group: simple-ci-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
jobs: | |
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/maybe-14.0.4/clang-tidy-14.AppImage | |
wget https://raw.githubusercontent.com/oneflow-inc/llvm-project/maybe/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | |
chmod +x clang-tidy-14.AppImage run-clang-tidy.py | |
- name: Build third party libs and generate files | |
run: | | |
mkdir build | |
cd build | |
cmake .. -C ../cmake/caches/international/cpu.cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_TESTING=ON | |
cmake --build . -j$(nproc) --target oneflow_deps of_protoobj of_functional_obj of_functional_tensor_obj of_op_schema | |
- name: Run clang-tidy for all translation units | |
# use clang as compiler for correct compiler flags | |
run: | | |
cd build | |
rm CMakeCache.txt | |
cmake .. -C ../cmake/caches/international/cpu.cmake \ | |
-DCMAKE_C_COMPILER=clang-12 \ | |
-DCMAKE_CXX_COMPILER=clang++-12 \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_TESTING=ON \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
cd .. | |
./run-clang-tidy.py -clang-tidy-binary ./clang-tidy-14.AppImage -p build -quiet -allow-enabling-alpha-checkers -extra-arg="-Xclang" -extra-arg="-analyzer-config" -extra-arg="-Xclang" -extra-arg="aggressive-binary-operation-simplification=true" "^(?!$(pwd)/build)" | |
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 }} | |
env: | |
CFLAGS: "-w" | |
CXXFLAGS: "-w" | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
test_suite: ["mac", "ubuntu"] | |
cmake_generator: ["Ninja", "Unix Makefiles"] | |
cmake_build_type: ["Debug", "Release"] | |
build_shared_libs: ["ON", "OFF"] | |
include: | |
- test_suite: mac | |
os: "macos-10.15" | |
make_concurrency: 2 | |
- test_suite: ubuntu | |
os: "ubuntu-20.04" | |
make_concurrency: 2 | |
exclude: | |
- test_suite: mac | |
cmake_build_type: "Debug" | |
- test_suite: mac | |
cmake_generator: "Ninja" | |
- test_suite: ubuntu | |
cmake_generator: "Ninja" | |
cmake_build_type: "Debug" | |
- test_suite: ubuntu | |
cmake_generator: "Ninja" | |
build_shared_libs: "OFF" | |
- test_suite: ubuntu | |
cmake_build_type: "Debug" | |
build_shared_libs: "OFF" | |
- test_suite: ubuntu | |
cmake_generator: "Unix Makefiles" | |
cmake_build_type: "Release" | |
steps: | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 5 | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install dependencies (homebrew) | |
if: matrix.test_suite == 'mac' | |
run: | | |
brew install nasm ninja | |
- name: Install dependencies (apt) | |
if: matrix.test_suite == 'ubuntu' | |
run: | | |
sudo apt install -y libopenblas-dev nasm g++ gcc python3-pip ninja-build | |
- name: Cache pip (Linux) | |
if: startsWith(runner.os, 'Linux') | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ matrix.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: Cache pip (macOS) | |
if: startsWith(runner.os, 'macOS') | |
uses: actions/cache@v2 | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ matrix.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: Install dependencies (pip) | |
run: | | |
python3 -m pip install -r ci/requirements.txt | |
python3 -m pip install -r dev-requirements.txt | |
- name: Set environment variables | |
run: | | |
set -x | |
cmake_flags="" | |
cmake_flags+=" -DBUILD_CUDA=OFF" | |
cmake_flags+=" -DBUILD_TESTING=ON" | |
cmake_flags+=" -G '${{ matrix.cmake_generator }}'" | |
cmake_flags+=" -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}" | |
cmake_flags+=" -DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }}" | |
cmake_flags+=" -DCMAKE_MACOSX_RPATH=FALSE" | |
cmake_flags+=" -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" | |
echo "cmake_flags=${cmake_flags}" >> $GITHUB_ENV | |
- name: Build (third party) | |
if: matrix.cmake_generator != 'Ninja' | |
run: | | |
set -x | |
mkdir -p build-third_party | |
mkdir -p third_party_install | |
cd build-third_party | |
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=ON -DONEFLOW=OFF -DTHIRD_PARTY_DIR=$PWD/../third_party_install | |
cmake --build . -j $(nproc) | |
- name: Build (oneflow) | |
if: matrix.cmake_generator != 'Ninja' | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON -DTHIRD_PARTY_DIR=$PWD/../third_party_install | |
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow | |
- name: Build (oneflow_internal) | |
if: always() && matrix.cmake_generator != 'Ninja' | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON | |
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_internal | |
- name: Build (oneflow_py) | |
if: always() && matrix.cmake_generator != 'Ninja' | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON | |
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_py | |
- name: Build (oneflow_testexe) | |
if: always() && matrix.cmake_generator != 'Ninja' | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON | |
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_testexe | |
- name: Build (ALL) | |
if: always() | |
continue-on-error: ${{ startsWith(runner.os, 'macOS') && matrix.cmake_generator == 'Ninja' && matrix.build_shared_libs == 'ON' }} | |
run: | | |
mkdir -p build | |
cd build | |
cmake .. ${{ env.cmake_flags }} | |
cmake --build . -j ${{ matrix.make_concurrency }} | |
- name: Exe test | |
if: always() | |
continue-on-error: true | |
run: | | |
ulimit -c | |
ulimit -c unlimited | |
ulimit -c | |
mkdir -p build | |
cd build | |
./bin/oneflow_testexe | |
- name: Op test | |
if: always() | |
continue-on-error: true | |
run: | | |
ulimit -c | |
ulimit -c unlimited | |
ulimit -c | |
source build/source.sh | |
ONEFLOW_TEST_GITHUB_HOSTED=1 ONEFLOW_TEST_CPU_ONLY=1 bash ci/test/1node_op_test.sh | |
- name: "Tar logs" | |
if: always() && contains(github.event.pull_request.labels.*.name, 'need-simple-ci-upload-artifact') | |
continue-on-error: true | |
run: | | |
set -ex | |
if [[ -d "${HOME}/oneflow_temp" ]] | |
then | |
tar -cvf home_oneflow_temp.tar ${HOME}/oneflow_temp | |
fi | |
if [[ -d "${PWD}/test_tmp_dir" ]] | |
then | |
tar -cvf cwd_test_tmp_dir.tar ${PWD}/test_tmp_dir | |
fi | |
- name: Upload logs | |
if: always() && contains(github.event.pull_request.labels.*.name, 'need-simple-ci-upload-artifact') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: logs-${{ matrix.test_suite }}-${{ matrix.cmake_generator }}-${{ matrix.cmake_build_type }}-shared-${{ matrix.build_shared_libs }} | |
path: | | |
home_oneflow_temp.tar | |
cwd_test_tmp_dir.tar | |
conda: | |
name: Build with conda | |
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: ubuntu-latest | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
build-type: ["gcc7", "clang10"] | |
steps: | |
- name: Checkout Oneflow-Inc/oneflow | |
uses: actions/checkout@v2 | |
- name: Checkout Oneflow-Inc/conda-env | |
uses: actions/checkout@v2 | |
with: | |
repository: Oneflow-Inc/conda-env | |
ref: 30a7f00eb48ee9009d85a848e720823e5054c66b | |
path: conda-env | |
- uses: Oneflow-Inc/get-oneflow@support-py311-py312 | |
name: Build with gcc7 | |
if: ${{ matrix.build-type == 'gcc7'}} | |
with: | |
cmake-init-cache: cmake/caches/ci/gh-hosted/cpu-gcc.cmake | |
oneflow-src: . | |
oneflow-build-env: conda | |
conda-env-file: conda-env/dev/gcc7/environment-v2.yml | |
conda-env-name: oneflow-dev-gcc7-v2 | |
- uses: Oneflow-Inc/get-oneflow@support-py311-py312 | |
name: Build with clang10 | |
if: ${{ matrix.build-type == 'clang10'}} | |
with: | |
cmake-init-cache: cmake/caches/ci/gh-hosted/cpu-clang.cmake | |
oneflow-src: . | |
oneflow-build-env: conda | |
conda-env-file: conda-env/dev/clang10/environment-v2.yml | |
conda-env-name: oneflow-dev-clang10-v2 |