Improvement: Implement FetchContent #325
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: t8code testsuite | |
| # This file is part of t8code. | |
| # t8code is a C library to manage a collection (a forest) of multiple | |
| # connected adaptive space-trees of general element types in parallel. | |
| # | |
| # Copyright (C) 2024 the developers | |
| # | |
| # t8code is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation; either version 2 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # t8code is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with t8code; if not, write to the Free Software Foundation, Inc., | |
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| # | |
| # This github CI script installs t8code and runs its tests for various configurations. | |
| # We compile sc and p4est as thirdparty libraries and use caching to only trigger a | |
| # new installation of them when their versions have changed in t8code. | |
| # | |
| # Note: To manually enforce sc and p4est installation, either increase the counter | |
| # in the "CACHE_COUNTER:" entries of the sc and p4est steps or set the variables | |
| # IGNORE_CACHE to true in the respective steps. | |
| on: | |
| merge_group: | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review, reopened] | |
| workflow_dispatch: # Be able to trigger this manually on github.com | |
| # Run every night at 1:10 | |
| schedule: | |
| - cron: '10 1 * * *' | |
| concurrency: | |
| # Base the group on workflow name and ref to allow concurrent runs for different branches, but not multiple runs for the same branch. | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # Always complete runs on the merge queue. | |
| cancel-in-progress: ${{ github.event_name != 'merge_group' }} | |
| # The CI pipeline should: | |
| # - fully run in the merge queue with the full test suite | |
| # - not run on draft PRs | |
| # - run on draft PRs, if the latest commit message contains '[run ci]' | |
| # - run on scheduled runs for the DLR-AMR/t8code repository | |
| # - run on all other pull request events | |
| # These conditions are checked in the fine_grained_trigger job. If it completes successfully, it triggers the preparation job, | |
| # which triggers the actual tests. | |
| # The job to build the tarball is only triggered on merge_group events for the DLR-AMR/t8code repository. | |
| jobs: | |
| fine_grained_trigger: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_ci: ${{ steps.set_run_ci.outputs.RUN_CI }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| fetch-depth: 0 | |
| - name: set the run_ci variable for the testsuite | |
| id: set_run_ci | |
| run: | | |
| if [[ "${{ github.event_name }}" == "schedule" && "${{ github.repository }}" == "DLR-AMR/t8code" ]]; then | |
| echo "Scheduled run for DLR-AMR/t8code, proceeding with CI." | |
| echo "RUN_CI=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [[ "${{ github.event_name }}" == "merge_group" ]]; then | |
| echo "Merge group event, proceeding with CI." | |
| echo "RUN_CI=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| latest_commit_message=$(git log -1 --pretty=%B) | |
| echo "Latest commit message: $latest_commit_message" | |
| if [[ "${{ github.event_name }}" != "schedule" ]]; then | |
| if [[ "${{ github.event.pull_request.draft }}" == "false" ]]; then | |
| echo "Not a draft PR, proceeding with CI." | |
| echo "RUN_CI=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [[ "${{ github.event.pull_request.draft }}" == "true" && "$latest_commit_message" == *"[run ci]"* ]]; then | |
| echo "Draft PR with '[run ci]' in the latest commit message, proceeding with CI." | |
| echo "RUN_CI=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [[ "${{github.event.pull_request.ready_for_review}}" == "true" ]]; then | |
| echo "PR ready for review, proceeding with CI." | |
| echo "RUN_CI=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| else | |
| echo "Draft PR without '[run ci]' in the latest commit message, skipping CI." | |
| echo "RUN_CI=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| else | |
| echo "Conditions not met, skipping CI." | |
| echo "RUN_CI=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Preparation step for tests. Repo is cloned and sc + p4est are compiled with and without MPI. | |
| preparation: | |
| needs: [fine_grained_trigger] | |
| secrets: inherit | |
| if: needs.fine_grained_trigger.outputs.run_ci == 'true' | |
| uses: ./.github/workflows/test_preparation.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [OFF, ON] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run | |
| CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once | |
| MPI: ${{ matrix.MPI }} | |
| # Run parallel tests for sc and p4est with and without MPI | |
| sc_p4est_tests: | |
| needs: preparation | |
| uses: ./.github/workflows/test_sc_p4est.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [OFF, ON] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| MPI: ${{ matrix.MPI }} | |
| # Run t8code tests with and without MPI and in serial and debug mode | |
| t8code_tests: | |
| needs: preparation | |
| uses: ./.github/workflows/test_t8code.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [OFF, ON] | |
| BUILD_TYPE: [Debug, Release] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| MPI: ${{ matrix.MPI }} | |
| BUILD_TYPE: ${{ matrix.BUILD_TYPE }} | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. | |
| # Run t8code linkage tests with and without MPI and in serial and debug mode | |
| t8code_linkage_tests: | |
| needs: preparation | |
| uses: ./.github/workflows/test_t8code_linkage.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [OFF, ON] | |
| BUILD_TYPE: [Debug, Release] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| MPI: ${{ matrix.MPI }} | |
| BUILD_TYPE: ${{ matrix.BUILD_TYPE }} | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. | |
| # Run t8code linkage tests with and without MPI and in serial and debug mode | |
| t8code_api_tests: | |
| needs: preparation | |
| uses: ./.github/workflows/test_t8code_api.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [ON] # For now the fortran API only supports building with MPI | |
| BUILD_TYPE: [Debug, Release] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| MPI: ${{ matrix.MPI }} | |
| BUILD_TYPE: ${{ matrix.BUILD_TYPE }} | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. | |
| # Run Valgrind check for every t8code test binary. | |
| t8code_valgrind_tests: | |
| if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') # Only run the Valgrind check in the scheduled run. | |
| needs: preparation | |
| uses: ./.github/workflows/test_valgrind.yml | |
| with: | |
| TEST_LEVEL: T8_TEST_LEVEL_BASIC # Do Valgrind check for test level T8_TEST_LEVEL_BASIC for performance reasons. | |
| # Generate code coverage and deploy to Codecov. | |
| t8code_code_coverage: | |
| if: (github.event_name != 'merge_group') | |
| needs: preparation | |
| uses: ./.github/workflows/code_coverage.yml | |
| with: | |
| MAKEFLAGS: -j4 | |
| MPI: ON | |
| BUILD_TYPE: Debug | |
| TEST_LEVEL: T8_TEST_LEVEL_BASIC | |
| secrets: | |
| CODE_COV: ${{ secrets.CODE_COV }} | |
| # Run t8code tests with shipped submodules. This test is only for the build system, so only one config is tested. | |
| t8code_w_shipped_submodules_tests: | |
| needs: fine_grained_trigger | |
| secrets: inherit | |
| if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} | |
| uses: ./.github/workflows/test_t8code_w_shipped_submodules.yml | |
| with: | |
| MAKEFLAGS: -j4 | |
| MPI: ON | |
| BUILD_TYPE: Debug | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. | |
| # Check t8code building and testing with the Clang compiler and openmpi. | |
| # Note: This workflow is meant to detect Clang- or openmpi-specific issues missed by the remaining (gcc- and mpich-based) workflows. | |
| # To reduce its runtime, it currently only uses one run in Debug mode with MPI activated and all external libraries like VTK or OpenCASCADE. | |
| t8code_w_clang_and_ompi_tests: | |
| needs: fine_grained_trigger | |
| secrets: inherit | |
| if: ${{ needs.fine_grained_trigger.outputs.run_ci == 'true' }} | |
| uses: ./.github/workflows/test_t8code_w_clang_and_ompi.yml | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MPI: [ON] | |
| BUILD_TYPE: [Debug] | |
| include: | |
| - MAKEFLAGS: -j4 | |
| with: | |
| MAKEFLAGS: ${{ matrix.MAKEFLAGS }} | |
| MPI: ${{ matrix.MPI }} | |
| BUILD_TYPE: ${{ matrix.BUILD_TYPE }} | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. | |
| # Build doxygen documentation and check for errors / warnings. | |
| t8code_doxygen_check: | |
| uses: ./.github/workflows/check_doxygen.yml | |
| t8code_tarball: | |
| if: github.event.pull_request.draft == false | |
| uses: ./.github/workflows/test_tarball.yml | |
| with: | |
| TEST_LEVEL: ${{ github.event_name == 'pull_request' && 'T8_TEST_LEVEL_MEDIUM' || 'T8_TEST_LEVEL_FULL' }} # Set TEST_LEVEL to medium if the event is a PR, otherwise full. |