Skip to content

Merge pull request #571 from ljhwang/patch-3 #1536

Merge pull request #571 from ljhwang/patch-3

Merge pull request #571 from ljhwang/patch-3 #1536

Workflow file for this run

name: tests
on:
push:
branches:
- 'main'
- 'GWB-*'
pull_request:
concurrency:
group: ${{ github.actor }}-${{ github.ref }}-test
cancel-in-progress: true
jobs:
test_indentation:
runs-on: ubuntu-latest
steps:
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Use cmake
run: cmake --version
- uses: actions/checkout@v2
- name: Install astyle
shell: bash
run: cd .. && mkdir astyle && cd astyle && wget 'https://sourceforge.net/projects/astyle/files/astyle/astyle 2.04/astyle_2.04_linux.tar.gz' && tar -zxvf astyle_2.04_linux.tar.gz && cd astyle/build/gcc && make && sudo make install && cd ../../../../
- name: Create Build Environment
run: |
mkdir build;
cd build;
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake ..
- name: Indenting
shell: bash
working-directory: ${{github.workspace}}/build
run: make indent
- name: Indenting
shell: bash
working-directory: ${{github.workspace}}/build
run: git status
- name: check indentation
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [[ "$(git status | grep 'modified' --count)" -gt "0" ]]; then
git diff > diff.log;
cat diff.log;
exit 1;
fi
test_linux_and_macos:
needs: test_indentation
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest','macos-latest','macos-11']
build_type: ['Release', 'Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install gfortran swig python3-setuptools
fi
shell: bash
- name: MacOS_xcode_select
run: |
if [ "$RUNNER_OS" != "Linux" ]; then
xcode-select -p
echo "1"
ls /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/
echo "2"
ls /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/
echo "3"
ls /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/libexec
echo "4"
sudo xcode-select --switch /Applications/Xcode_13.2.1.app
fi
shell: bash
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DWB_ENABLE_PYTHON=OFF
fi
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
test_linux_non_unity_no_optional_dependencies:
needs: test_indentation
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
build_type: ['Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DWB_UNITY_BUILD=OFF
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
test_windows:
needs: test_indentation
strategy:
fail-fast: false
matrix:
os: ['windows-2022']
build_type: ['Release', 'Debug']
build_system: ['Visual Studio 17 2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
# python in combination with cmake seems to be broken on github actions windows
# todo: fix it
#- name: Install optional dependencies
# run: choco install swig -version=4.0.1 -y
# shell: bash
- uses: ilammy/msvc-dev-cmd@v1
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake -G"${{ matrix.build_system }}" $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DWB_ENABLE_PYTHON=OFF -DWB_MAKE_FORTRAN_WRAPPER=OFF
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb windows
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }} -E _no_coordinates
test_linux_and_macos_mpi:
needs: test_indentation
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest','macos-latest']
build_type: ['Release']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update;
sudo apt install gfortran swig python3-setuptools openmpi-bin libopenmpi-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo brew install open-mpi || true
echo "4"
sudo xcode-select --switch /Applications/Xcode_13.2.1.app
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DWB_ENABLE_PYTHON=OFF
fi
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: sudo apt install gfortran swig python3-setuptools openmpi-bin libopenmpi-dev
shell: bash
- name: extend path
run: echo $PATH && export PATH=$PATH:/home/runner/.local/bin && echo $PATH && export PYTHONPATH=$PYTHONPATH:/home/runner/.local/bin
- name: Install coveralls
run: pip install --user cpp-coveralls
shell: bash
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Coverage
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config Coverage
- name: Install gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config Coverage
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: |
ctest -VV -C Coverage;
ls;
- name: Codecov
run: bash <(curl -s https://codecov.io/bash);
shell: bash
- name: lcov
working-directory: ${{github.workspace}}/build
shell: bash
run: |
sudo apt install lcov;
lcov --capture --directory ${{github.workspace}}/build --output-file coverage.info;
lcov --remove coverage.info '${{github.workspace}}/build/*' '${{github.workspace}}/source/gwb-grid/*' '${{github.workspace}}/include/*' '${{github.workspace}}/tests/*' '/usr/*' -o coverage_filtered.info
ls;
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{github.workspace}}/build/coverage_filtered.info
linux-cmake_mpi:
needs: [test_indentation,coverage]
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
cmake_version: ['2.8.12','3.16.x', '3.20.x']
use_mpi: ['TRUE','FALSE']
build_type: ['Release']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update;
sudo apt install gfortran swig python3-setuptools openmpi-bin libopenmpi-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo brew install open-mpi || true
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: ${{ matrix.cmake_version }}
- name: Use cmake
run: cmake --version
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DUSE_MPI=${{ matrix.use_mpi }};
cat ${{github.workspace}}/build/CMakeFiles/CMakeError.log ||:;
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
linux-gcc_mpi:
needs: [test_indentation,coverage]
strategy:
fail-fast: false
matrix:
os: ['ubuntu-20.04']
build_type: ['Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update;
sudo apt install gfortran swig python3-setuptools openmpi-bin
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo brew install open-mpi || true
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: CMake version
run: cmake --version
- name: GCC version
run: gcc --version
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror;
cat ${{github.workspace}}/build/CMakeFiles/CMakeError.log ||:;
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
linux-gdb-valgrind:
needs: [test_indentation]
strategy:
fail-fast: false
matrix:
os: ['ubuntu-22.04']
build_type: ['Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install optional dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update;
sudo apt install gfortran swig python3-setuptools gdb valgrind
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo brew install open-mpi || true
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: CMake version
run: cmake --version
- name: GCC version
run: gcc --version
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DWB_RUN_TESTS_WITH_GDB=ON -DWB_RUN_TESTS_WITH_VALGRIND=OFF;
cat ${{github.workspace}}/build/CMakeFiles/CMakeError.log ||:;
- name: Build gwb
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install gwb Linux and macOS
working-directory: ${{github.workspace}}/build
shell: bash
run: sudo cmake --install . --config ${{ matrix.build_type }}
- name: Test gwb normal and gdb
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }} -E _no_coordinates_gdb
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=-Werror -DWB_RUN_TESTS_WITH_GDB=OFF -DWB_RUN_TESTS_WITH_VALGRIND=ON;
cat ${{github.workspace}}/build/CMakeFiles/CMakeError.log ||:;
- name: Test gwb valgrind
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -VV -C ${{ matrix.build_type }} -R _valgrind -E _no_coordinates_valgrind