From f8d61b61ec569b1bbec373aea05546bbe7aecc70 Mon Sep 17 00:00:00 2001 From: Christophe Date: Sat, 16 Dec 2023 10:59:34 +0100 Subject: [PATCH] c.i.: Add github actions --- .../actions/build-and-test/action.yml | 49 ++++++++++++ .github/workflows/test.yml | 78 +++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 .github/workflows/actions/build-and-test/action.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/actions/build-and-test/action.yml b/.github/workflows/actions/build-and-test/action.yml new file mode 100644 index 0000000000..88b7909bf1 --- /dev/null +++ b/.github/workflows/actions/build-and-test/action.yml @@ -0,0 +1,49 @@ +name: Build and test + +inputs: + build_dir: + description: "The build dir to use" + required: true + std: + description: "The C++ standard to use" + required: true + build_type: + description: "The build type to use" + default: Debug + sse3: + description: "Whether to enable sse3" + default: OFF + avx: + description: "Whether to enable avx" + default: OFF + pure: + description: "Whether to enable pure" + default: OFF + lang_extensions: + description: "Whether to enable lang extensions" + default: OFF + +runs: + using: "composite" + steps: + - name: Build GLM + shell: bash + run: | + mkdir -p ${{ inputs.build_dir }} + + cmake -DCMAKE_INSTALL_PREFIX=$RUNNER_TEMP/install \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ + -DGLM_TEST_ENABLE=ON \ + -DGLM_TEST_ENABLE_CXX_${{ inputs.std}}=ON \ + -DGLM_TEST_ENABLE_SIMD_SSE3=${{ inputs.sse3 }} \ + -DGLM_TEST_ENABLE_SIMD_AVX=${{ inputs.avx }} \ + -DGLM_TEST_FORCE_PURE=${{ inputs.pure }} \ + -DGLM_TEST_ENABLE_LANG_EXTENSIONS=${{ inputs.lang_extensions }} \ + -S . \ + -B ${{ inputs.build_dir }} + cmake --build ${{ inputs.build_dir }} --parallel 2 + + - name: Run tests + shell: bash + run: + ctest --test-dir ${{ inputs.build_dir }} --output-on-failure --parallel 4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..53455af65c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,78 @@ +name: GLM tests + +on: [push] + +jobs: + test: + name: "${{ matrix.os}} ${{ matrix.cxx }} C++:${{ matrix.std }}" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + cxx: [g++, clang++] + std: [11, 14, 17] + os: [ubuntu-latest, macos-latest] + + exclude: + - os: macos-latest + cxx: g++ + + env: + CXX: ${{ matrix.cxx }} + + steps: + - uses: actions/checkout@v3 + + - name: Tool versions + run: | + ${CXX} --version + cmake --version + + - name: Standard build + uses: ./.github/actions/build-and-test + with: + build_dir: build + std: ${{ matrix.std }} + + - name: SSE3 build + uses: ./.github/actions/build-and-test + with: + build_dir: build_sse3 + std: ${{ matrix.std }} + sse3: ON + + - name: AVX build + uses: ./.github/actions/build-and-test + with: + build_dir: build_avx + std: ${{ matrix.std }} + avx: ON + + - name: Pure build + uses: ./.github/actions/build-and-test + with: + build_dir: build_pure + std: ${{ matrix.std }} + pure: ON + + - name: Lang extensions build + uses: ./.github/actions/build-and-test + with: + build_dir: build_lang_extensions + std: ${{ matrix.std }} + lang_extensions: ON + + - name: release build + uses: ./.github/actions/build-and-test + with: + build_dir: build_release + std: ${{ matrix.std }} + build_type: Release + + - name: Test installing and using GLM + run: | + cmake --build build --target install + mkdir build_test_cmake + cmake -DCMAKE_PREFIX_PATH=$RUNNER_TEMP/install -S ./test/cmake -B build_test_cmake + cmake --build build_test_cmake + ./build_test_cmake/test_find_glm