Skip to content

CI pipeline setup and testing#95

Draft
piyushkarki wants to merge 184 commits intorelease-v1.2.0from
piyush/thomas/docker
Draft

CI pipeline setup and testing#95
piyushkarki wants to merge 184 commits intorelease-v1.2.0from
piyush/thomas/docker

Conversation

@piyushkarki
Copy link
Copy Markdown
Collaborator

@piyushkarki piyushkarki commented Jul 7, 2025

Modify CI Workflows and Add Regression Testing

Summary

This pull request introduces major updates to the CI system and testing infrastructure for tandem. The key changes include:

  • Reusable GitHub Actions workflows
  • Docker-based build and test environment
  • Regression and consistency testing
  • Infrastructure for SEAS cycle simulations
  • Serves as a foundation to add more tests in the future

What's Changed

CI Workflows

Added:

  • .github/workflows/build-and-test-tandem.yml — Builds and tests across multiple compilers and dimensions
  • .github/workflows/build-dependencies.yml — Builds the Docker image with project dependencies
  • .github/workflows/check-petsc-version.yml — Checks for PETSc version updates and triggers dependency rebuilds
  • .github/workflows/main-workflow.yml — Main entry point that triggers all the workflows in the CI pipeline

Modified:

  • Renamed clang-format.yml to check-clang-format.yml for clarity

Removed:

  • Deprecated build-tandem.yml workflow

Docker Support

  • Introduced a new Dockerfile that:
    • Installs all necessary system and Python dependencies
    • Builds PETSc with a specified version (major=3, minor=22, patch=latest available)
    • Sets up a non-root user for MPI compatibility
    • Creates a Python virtual environment for test tooling

Testing Infrastructure

  • Added comprehensive test suite:
    • Static regression tests (2D and 3D)
    • SEAS regression tests (2D)
    • Parallel consistency checks (2D and 3D)
    • Convergence tests (2D and 3D)
  • Added test utilities in conftest.py:
    • Fixtures for loading VTU files
    • Output comparison logic
    • Error computations
    • Tolerance values to be decided and modified
  • Integrated test data as a separate repo pulled later

Testing

The CI pipeline performs the following:

  1. Checks code formatting with clang-format
  2. Verifies PETSc version compatibility
  3. Builds Docker-based dependencies if needed
  4. Builds and tests the code using:
    • Multiple compilers (GCC 13, Clang 18)
    • 2D and 3D configurations
    • Polynomial degree 3
  5. Runs the full test suite (make test)

Test Suite Details

The test suite is divided into C++ Unit Tests for fine-grained component checks and Pytest Integration Tests for overall simulation validation.

Test Directory Structure

Test configurations and generator scripts are maintained directly within the repository to keep tests closely coupled with the code.

  • reference_configs/: Contains simulation configurations (.toml, .lua, .geo) separated by dimension (2D/, 3D/).
  • scripts/: Contains the individual shell scripts used to generate reference output data for each test.
  • test_data/: The destination folder where the external tandem_test_data repository is cloned (only when integration tests are enabled).

Running the Tests

Basic Unit Tests

By default, compiling the tests will only prepare the local C++ unit tests. Run them using:

make test

Integration Tests (CI)

Integration tests require heavy reference data (meshes, Green's functions, .vtu files). Before running them, install the required Python dependencies:

pip install -r test/requirements.txt

Then compile with:

cmake -DRUN_CI_TESTS=ON ..

Note: This flag automatically clones the tandem_test_data repository into the local test_data/ directory.

Testing with Custom Data Branches

By default, the CI setup pulls the master branch of the tandem_test_data repository. If you are developing a new feature and need a custom branch of the test data, you can specify it during configuration using -DTEST_DATA_BRANCH.

Example: If you are working on a Tandem branch named <user-name>/add-feature-1, create a corresponding data branch <user-name>/add-data-for-feature-1 in the data repo and compile with:

cmake -DRUN_CI_TESTS=ON -DTEST_DATA_BRANCH=<user-name>/add-data-for-feature-1 ..

For more test details, please see the README.md inside the test directory.

Notes

  • Docker image ensures reproducibility and local/CI parity
  • This infrastructure is designed for extensibility and future enhancements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants