add method to limit number of parallel jobs #57
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: unit tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
skip_duplicate: | |
name: 'Check whether to skip job' | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
paths: '["tpie/", "test/"]' | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
linux_test: | |
name: 'Unit test (Linux, ${{matrix.cc.cc}}-${{matrix.cc.v}}, ${{matrix.build_type}})' | |
runs-on: ${{ matrix.os }} | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
build_type: [Release] #, Debug, ExtraDebug] | |
cc: | |
# GNU Compiler | |
- { cc: gcc, v: 7, cxx: g++ } # oldest possible | |
- { cc: gcc, v: 9, cxx: g++ } # default | |
- { cc: gcc, v: 10, cxx: g++ } # newest | |
# Clang Compiler | |
- { cc: clang, v: 7, cxx: clang++ } # oldest possible | |
- { cc: clang, v: 11, cxx: clang++ } # newst possible | |
env: | |
cc: ${{matrix.cc.cc}}-${{matrix.cc.v}} | |
cxx: ${{matrix.cc.cxx}}-${{matrix.cc.v}} | |
macro_flags: '-DLZ4_compress_default\(a,b,c,d\)=LZ4_compress\(a,b,c\)' | |
steps: | |
# Git repo set up | |
- name: Checkout commit | |
uses: actions/checkout@v2 | |
# Installation Linux | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
echo "================================" | |
echo "Compiler" | |
sudo apt install build-essential | |
sudo apt install ${{matrix.cc.cc}}-${{matrix.cc.v}} | |
echo "================================" | |
echo "Boost" | |
sudo apt install libboost-all-dev | |
echo "================================" | |
echo "Snappy" | |
sudo apt install libsnappy-dev | |
echo "================================" | |
echo "LZ4" | |
sudo apt install liblz4-dev | |
echo "================================" | |
echo "ZSTD" | |
export CC=${{env.cc}} | |
export CCX=${{env.cxx}} | |
export MACRO_FLAGS="${{env.macro_flags}}" | |
git clone https://github.com/facebook/zstd | |
cd zstd | |
git checkout tags/v1.3.1 | |
sudo make install | |
# CMake build and run | |
- name: CMake build | |
working-directory: ${{runner.workspace}} | |
run: | | |
export CC=${{env.cc}} | |
if [ "${{ matrix.cc.cc }}" != "gcc" ] ; | |
then | |
export CXX=${{env.cxx}} | |
fi | |
export MACRO_FLAGS="${{env.macro_flags}}" | |
cmake -E make_directory ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake -D CMAKE_BUILD_TYPE="${{matrix.build_type}}" -D CMAKE_CXX_STANDARD=14 -D CMAKE_C_FLAGS="$MACRO_FLAGS" -D CMAKE_CXX_FLAGS="$MACRO_FLAGS" .. | |
make -j2 | |
- name: CTest run | |
working-directory: ${{github.workspace}}/build | |
run: ctest --timeout 30 | |
# Check if tests are missing | |
- name: Check missing CTests | |
working-directory: ${{github.workspace}} | |
run: | | |
sudo apt install python3 python3-pip | |
pip install cmakeast | |
python3 scripts/check_missing_ctests.py | |
macos_test: | |
name: 'Unit test (Mac OS, ${{matrix.cc.cc}}@${{matrix.cc.v || matrix.cc.xcode}}, ${{matrix.build_type}})' | |
runs-on: ${{ matrix.os }} | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest] | |
build_type: [Release] #, Debug, ExtraDebug] | |
cc: | |
# GNU Compiler | |
- { cc: gcc, v: 7, cxx: g++, xcode: latest } | |
- { cc: gcc, v: 10, cxx: g++, xcode: latest } | |
# Clang Compiler | |
- { cc: clang, cxx: clang++, xcode: 11.7 } # oldest | |
- { cc: clang, cxx: clang++, xcode: 12.4 } | |
- { cc: clang, cxx: clang++, xcode: 13.1 } | |
- { cc: clang, cxx: clang++, xcode: 13.2 } # newest | |
steps: | |
# Git repo set up | |
- name: Checkout commit | |
uses: actions/checkout@v2 | |
# Install dependencies | |
- name: Install xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{matrix.cc.xcode}} | |
- name: Install dependencies | |
run: | | |
brew update | |
if ["${{matrix.cc.cc}}" == "gcc"]; | |
then | |
echo "================================" | |
echo "Compiler" | |
brew install ${{matrix.cc.cc}}@${{matrix.cc.v}} | |
fi | |
echo "================================" | |
echo "Boost" | |
brew install boost | |
echo "================================" | |
echo "Snappy" | |
brew install snappy | |
echo "================================" | |
echo "LZ4" | |
brew install lz4 | |
echo "================================" | |
echo "ZSTD" | |
brew install zstd | |
# CMake build and run | |
- name: CMake build | |
working-directory: ${{runner.workspace}} | |
run: | | |
if [ "${{ matrix.cc.cc }}" == "gcc" ] ; | |
then | |
export CC=/usr/bin/${{matrix.cc.cc}} | |
export CXX=/usr/bin/${{matrix.cc.cxx}} | |
else | |
export CC=${{matrix.cc.cc}} | |
export CXX=${{matrix.cc.cxx}} | |
fi | |
cmake -E make_directory ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake -D CMAKE_BUILD_TYPE="${{matrix.build_type}}" -D CMAKE_CXX_STANDARD=14 .. | |
make -j2 | |
- name: CTest run | |
working-directory: ${{github.workspace}}/build | |
run: ctest --timeout 30 | |
# Check if tests are missing | |
- name: Check missing CTests | |
working-directory: ${{github.workspace}} | |
run: | | |
brew install python3 | |
pip3 install cmakeast | |
python3 scripts/check_missing_ctests.py |