Skip to content

Feature conditioned compilation for netcdf #1218

Feature conditioned compilation for netcdf

Feature conditioned compilation for netcdf #1218

name: t8code CMake 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:
workflow_dispatch: # Be able to trigger this manually on github.com
# Run every night at 1:10
schedule:
- cron: '10 1 * * *'
# 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@v4
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 testsute
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
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/tests_cmake_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/tests_cmake_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/tests_cmake_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' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_linkage_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_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' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_api_tests:
needs: preparation
uses: ./.github/workflows/tests_cmake_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' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
# 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/tests_cmake_t8code_w_shipped_submodules.yml
with:
MAKEFLAGS: -j4
MPI: ON
BUILD_TYPE: Debug
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.
t8code_tarball:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/build_cmake_tarball.yml
needs: [preparation, sc_p4est_tests, t8code_tests, t8code_linkage_tests, t8code_api_tests, t8code_w_shipped_submodules_tests]
with:
TEST_LEVEL: ${{ github.event_name == 'pull_request' && 1 || 0 }} # Set TEST_LEVEL to 1 if the event is a PR, otherwise 0.