reactphysics3d/.github/workflows/build-and-test.yml

122 lines
4.7 KiB
YAML
Raw Normal View History

2021-08-02 20:59:51 +00:00
# Build and run tests for ReactPhysics3D
name: Build and Test ReactPhysics3D
# Controls when the action will run. Triggers the workflow on push
on:
push:
pull_request:
release:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
2021-08-03 13:06:33 +00:00
name: "Ubuntu Latest GCC",
2021-08-02 20:59:51 +00:00
os: ubuntu-latest,
artifact: "ubuntu_gcc.7z",
build_type: "Release",
cc: "gcc",
cxx: "g++",
archiver: "7z a",
2021-08-03 13:06:33 +00:00
generators: "Ninja",
double_precision: false
2021-08-02 20:59:51 +00:00
}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
2021-08-03 13:06:33 +00:00
2021-08-02 20:59:51 +00:00
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake
ninja --version
cmake --version
# cmd "${{ matrix.config.environment_script }}"
2021-08-03 13:06:33 +00:00
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu Latest GCC')
2021-08-02 20:59:51 +00:00
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake
ninja --version
cmake --version
gcc --version
2021-08-03 13:06:33 +00:00
2021-08-02 20:59:51 +00:00
- name: Install dependencies on ubuntu9
if: startsWith(matrix.config.name, 'Ubuntu_GCC_9')
run: |
echo Update gcc-9 =======================================================================
echo gcc version before
gcc --version
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install ninja-build cmake gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
echo gcc version after
gcc --version
echo Update ninja =======================================================================
echo ninja version before
ninja --version
# wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
wget https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
echo ninja version after
ninja --version
echo Update cmake =======================================================================
echo cmake version before
cmake --version
# curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2
# wget https://github.com/Kitware/CMake/releases/latest/download/cmake-3.16.5-Linux-x86_64.sh
cmake_version=$(curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 | cut -c 2-)
echo cmake download latest v$cmake_version version
wget https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-Linux-x86_64.sh
chmod +x cmake-$cmake_version-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo ./cmake-$cmake_version-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force
echo cmake version after
cmake --version
2021-08-03 13:06:33 +00:00
- name: Install dependencies on MacOS
2021-08-02 20:59:51 +00:00
if: startsWith(matrix.config.os, 'macos')
run: |
2021-08-03 13:06:33 +00:00
brew install cmake ninja
2021-08-02 20:59:51 +00:00
ninja --version
cmake --version
2021-08-03 13:06:33 +00:00
- name: CMake Configure
2021-08-02 20:59:51 +00:00
shell: bash
run: |
mkdir build
cmake \
-S . \
2021-08-03 21:02:51 +00:00
-B build \
2021-08-02 20:59:51 +00:00
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
2021-08-03 13:06:33 +00:00
-DRP3D_DOUBLE_PRECISION_ENABLED=${{ matrix.config.double_precision }} \
-DRP3D_COMPILE_TESTS=True \
2021-08-02 20:59:51 +00:00
-G "${{ matrix.config.generators }}" \
2021-08-03 13:06:33 +00:00
2021-08-02 20:59:51 +00:00
- name: Build
shell: bash
2021-08-03 21:02:51 +00:00
run: cmake --build build/ --config ${{ matrix.config.build_type }}
2021-08-03 13:06:33 +00:00
2021-08-03 21:08:10 +00:00
- name: Unit Tests
shell: bash
run: ./build/test/tests