Merge pull request #266 from uliegecsm/cmake_googletest #1720
This file contains hidden or 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: Run tests | |
| description: Build and test. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # At 06:00 on Sunday. | |
| - cron: '0 6 * * 0' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| packages: read | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-images: | |
| uses: ./.github/workflows/build.images.yml | |
| secrets: inherit | |
| permissions: | |
| contents: read | |
| packages: write | |
| pull-requests: read | |
| format: | |
| uses: ./.github/workflows/format.yml | |
| build-and-test-smoke: | |
| needs: [build-images] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - {compiler: {family: gnu, version: 14}, cmake_build_type: Debug} | |
| container: | |
| image: ${{ needs.build-images.outputs.CI_IMAGE }}:${{ matrix.compiler.family }}-${{ matrix.compiler.version }}-${{ matrix.cmake_build_type }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: true | |
| - uses: actions/cache@v6 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: ccache-${{ runner.os }}-${{ matrix.compiler.family }}-${{ matrix.compiler.version }}-${{ github.ref }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-${{ runner.os }}-${{ matrix.compiler.family }}-${{ matrix.compiler.version }}-${{ github.ref }}- | |
| ccache-${{ runner.os }}-${{ matrix.compiler.family }}-${{ matrix.compiler.version }}- | |
| - run : | | |
| ccache --set-config=max_size=100M | |
| ccache --set-config=compression=true | |
| ccache --set-config=base_dir=$GITHUB_WORKSPACE | |
| ccache --set-config=cache_dir=$GITHUB_WORKSPACE/.ccache | |
| - run: ccache --verbose --show-stats | |
| - run: cmake -S . --preset=${{ matrix.compiler.family }} -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} | |
| - run: cmake --build --preset=${{ matrix.compiler.family }} -j4 | |
| - run: ctest --preset=${{ matrix.compiler.family }} | |
| - run: bash tests/install_test.sh ${{ matrix.compiler.family }} ${{ matrix.compiler.family }} | |
| build-and-test: | |
| needs: [build-images, format, build-and-test-smoke] | |
| runs-on: ${{ matrix.runs-on && fromJSON(matrix.runs-on) || 'ubuntu-latest' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - kokkos_backends: [Threads] | |
| compiler: | |
| family: gnu | |
| version: 14 | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 14}, cmake_build_type: Debug} | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 14}, cmake_build_type: Release} | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 15}, cxxstd: "23"} | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 14}, cxxflags: "-fsanitize=address"} | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 14}, cxxflags: "-fsanitize=leak"} | |
| - {kokkos_backends: [OpenMP], compiler: {family: gnu, version: 14}, cxxflags: "-fsanitize=thread -Wno-error=tsan", env: {OMP_NUM_THREADS: 1}} | |
| - {kokkos_backends: [OpenMP], compiler: {family: clang, version: 22}, cxxstd: "20", extra_type_checking: true} | |
| - {kokkos_backends: [OpenMP], compiler: {family: clang, version: 22}, cxxstd: "23"} | |
| - {kokkos_backends: [OpenMP], compiler: {family: clang, version: 22}, cxxstd: "20", cmake_build_type: Debug} | |
| - kokkos_backends: [HPX] | |
| compiler: | |
| family: gnu | |
| version: 14 | |
| - {kokkos_backends: [HPX], compiler: {family: clang, version: 22}} | |
| - {kokkos_backends: [HPX], compiler: {family: clang, version: 22}, cxxflags: "-fsanitize=address"} | |
| - {kokkos_backends: [HPX], compiler: {family: clang, version: 22}, cxxflags: "-fsanitize=leak"} | |
| - kokkos_backends: [OpenMP, Cuda] | |
| compiler: | |
| family: clang | |
| version: 21 | |
| runs-on : "['self-hosted', 'linux', 'docker', 'amd64', 'volta70', 'gpu:0']" | |
| tag_suffix : -volta70 | |
| - kokkos_backends: [OpenMP, Cuda] | |
| compiler: | |
| family: clang | |
| version: 22 | |
| runs-on : "['self-hosted', 'linux', 'docker', 'amd64', 'blackwell120', 'gpu:0']" | |
| tag_suffix : -blackwell120 | |
| - kokkos_backends: [HPX, Cuda] | |
| compiler: | |
| family: clang | |
| version: 22 | |
| runs-on : "['self-hosted', 'linux', 'docker', 'amd64', 'blackwell120', 'gpu:0']" | |
| tag_suffix : -blackwell120 | |
| extra_type_checking: true | |
| - kokkos_backends: [OpenMP, HIP] | |
| compiler: | |
| family: rocm | |
| version: 7.0.2 | |
| runs-on : "['self-hosted', 'linux', 'docker', 'amd64', 'amd_gfx1201', 'gpu:0']" | |
| docker_run_args: --device /dev/kfd --device /dev/dri | |
| tag_suffix : -zen5-amd_gfx1201 | |
| - kokkos_backends: [OpenMP, SYCL] | |
| compiler: | |
| family: intel | |
| version: '2025.2' | |
| runs-on: "['self-hosted', 'linux', 'docker', 'amd64', 'volta70', 'gpu:0']" | |
| tag_suffix: -volta70 | |
| - kokkos_backends: [OpenMP] | |
| compiler: | |
| family: clang | |
| version: 22 | |
| runs-on: "['ubuntu-24.04-arm']" | |
| tag_suffix: -arm64 | |
| container: | |
| image: ${{ needs.build-images.outputs.CI_IMAGE }}:${{ matrix.compiler.family }}-${{ matrix.compiler.version }}-${{ matrix.kokkos_backends && format('{0}-', join(matrix.kokkos_backends, '-')) || '' }}${{ matrix.cmake_build_type || 'Release' }}${{ matrix.tag_suffix }} | |
| # The 'options' field cannot be empty. Provide '--annotation' to ensure that if 'docker_run_args' is empty, the workflow is still valid. | |
| options: "--annotation ref=${{ github.ref }} ${{ matrix.docker_run_args }}" | |
| env: ${{ matrix.env || fromJSON('{}') }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: true | |
| - name: Compute a key that uniquely identifies the current job, given the matrix. | |
| run: | | |
| UNIQUE_JOB_KEY=${{ runner.os }}-${{ matrix.compiler.family }}-${{ matrix.compiler.version }}-${{ matrix.cmake_build_type || 'Release' }}-${{ matrix.cxxstd || 20 }}-${{ join(matrix.kokkos_backends, '-') }}-${{ runner.arch }} | |
| echo "This job is identified by '${UNIQUE_JOB_KEY}'." | |
| echo "UNIQUE_JOB_KEY=${UNIQUE_JOB_KEY}" >> $GITHUB_ENV | |
| - if: runner.environment == 'github-hosted' | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: ccache-${{ env.UNIQUE_JOB_KEY }}-${{ github.ref }}-${{ github.sha }} | |
| restore-keys: | | |
| ccache-${{ env.UNIQUE_JOB_KEY }}-${{ github.ref }}- | |
| ccache-${{ env.UNIQUE_JOB_KEY }}- | |
| - if: runner.environment == 'github-hosted' | |
| run : | | |
| ccache --set-config=max_size=100M | |
| ccache --set-config=compression=true | |
| ccache --set-config=base_dir=$GITHUB_WORKSPACE | |
| ccache --set-config=cache_dir=$GITHUB_WORKSPACE/.ccache | |
| - run: ccache --verbose --show-stats | |
| - run: | | |
| cmake -S . --preset=${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }} \ | |
| -DCMAKE_CXX_FLAGS="${{ matrix.cxxflags }}" \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type || 'Release' }} \ | |
| -DKokkosExecution_ENABLE_EXTRA_TYPE_CHECKING=${{ matrix.extra_type_checking && 'ON' || 'OFF' }} \ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd || 20 }} | |
| - run: | | |
| cmake --build --preset=${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }} -j4 | |
| - run: | | |
| ctest --preset=${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }} | |
| - name: CTest output artifact exists. | |
| if: always() | |
| run: | | |
| test -f build-with-${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }}/Testing/Temporary/LastTest.log | |
| - name: CTest output artifact upload. | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ env.UNIQUE_JOB_KEY }}-${{ job.check_run_id }} | |
| retention-days: 1 | |
| path: | | |
| build-with-${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }}/Testing/Temporary/LastTest.log | |
| - run: | | |
| bash tests/install_test.sh ${{ matrix.compiler.family }} ${{ matrix.compiler.family }}-${{ join(matrix.kokkos_backends, '-') }} | |
| documentation: | |
| needs: [build-images, format] | |
| runs-on: [self-hosted, linux, docker, amd64] | |
| container: | |
| image: ${{ needs.build-images.outputs.CI_IMAGE }}:gnu-14-OpenMP-Release | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: true | |
| - run: | | |
| cmake -S . --preset=gnu-OpenMP -DKokkosExecution_ENABLE_DOCS=ON | |
| - run: | | |
| cmake --build --preset=gnu-OpenMP -j4 --target=docs | |
| - uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: build-with-gnu-OpenMP/docs/html | |
| # The deploy job is heavily inspired from https://github.com/actions/deploy-pages. | |
| deploy: | |
| # The deployment only happens if the library can be built and the documentation generated. | |
| needs: [build-and-test-smoke, build-and-test, documentation] | |
| runs-on: ubuntu-latest | |
| # The deployment only happens for 'main' branch. | |
| if: ${{ ! failure() && ! cancelled() && github.ref == 'refs/heads/main' }} | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment. | |
| permissions: | |
| pages: write | |
| id-token: write | |
| # Deploy to the github-pages environment. | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages. | |
| id : deployment | |
| uses: actions/deploy-pages@v5 |