Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI to a more finegrained CI #1429

Merged
merged 22 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/check_indentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ name: t8code indentation check

on:
merge_group:
push:
branches:
- main
pull_request:
workflow_dispatch: # Be able to trigger this manually on github.com
# Run every night at 1:05
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: spell_check

on:
merge_group:
push:
branches:
- main
pull_request:
workflow_dispatch: # Be able to trigger this manually on github.com

Expand Down
74 changes: 61 additions & 13 deletions .github/workflows/tests_cmake_testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,69 @@ name: t8code CMake testsuite

on:
merge_group:
push:
branches:
- main
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
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:
if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
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
Expand All @@ -60,7 +110,6 @@ jobs:

# Run parallel tests for sc and p4est with and without MPI
sc_p4est_tests:
if: ((github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule'))
needs: preparation
uses: ./.github/workflows/tests_cmake_sc_p4est.yml
strategy:
Expand All @@ -75,7 +124,7 @@ jobs:

# Run t8code tests with and without MPI and in serial and debug mode
t8code_tests:
if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code.yml
strategy:
fail-fast: false
Expand All @@ -84,7 +133,6 @@ jobs:
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
needs: preparation
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
Expand All @@ -93,7 +141,7 @@ jobs:

# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_linkage_tests:
if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code_linkage.yml
strategy:
fail-fast: false
Expand All @@ -102,7 +150,6 @@ jobs:
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
needs: preparation
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
Expand All @@ -111,7 +158,7 @@ jobs:

# Run t8code linkage tests with and without MPI and in serial and debug mode
t8code_api_tests:
if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
needs: preparation
uses: ./.github/workflows/tests_cmake_t8code_api.yml
strategy:
fail-fast: false
Expand All @@ -120,7 +167,6 @@ jobs:
BUILD_TYPE: [Debug, Release]
include:
- MAKEFLAGS: -j4
needs: preparation
with:
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
MPI: ${{ matrix.MPI }}
Expand All @@ -129,7 +175,9 @@ jobs:

# 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:
if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
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
Expand All @@ -138,7 +186,7 @@ jobs:
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_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')
if: github.event.pull_request == 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:
Expand Down