Skip to content

Commit 9f8e5a0

Browse files
authored
Merge pull request #85 from DARMA-tasking/32-vt-tv-improve-ci
#32: vt-tv: Improve CI
2 parents d1e50fb + 74e084b commit 9f8e5a0

File tree

220 files changed

+18719
-21259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+18719
-21259
lines changed

.github/workflows/action-git-diff-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Run git check
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
1313
ref: ${{ github.event.pull_request.head.sha }}

.github/workflows/build-and-test-bindings.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/build-and-test-vt-tv.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build and Test
2+
3+
# Trigger the workflow on push or pull request
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
types: [opened, reopened, synchronize, converted_to_draft, ready_for_review]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
image:
18+
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8
19+
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8
20+
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
21+
env:
22+
OUTPUT_DIR: '/tmp/artifacts'
23+
VT_TV_TESTS_ENABLED: 'ON' # Build & Test in all configurations
24+
VT_TV_COVERAGE_ENABLED: ${{ matrix.image == 'ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8' && 'ON' || 'OFF' }} # Coverage only with main test image
25+
VT_TV_PYTHON_BINDINGS_ENABLED: 'ON'
26+
DOCKER_REPOSITORY: lifflander1/vt
27+
name: vt-tv build and test
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: CI Variables
32+
id: vars
33+
run: echo "DOCKER_TAG=$(echo ${{ github.ref }} | cut -d'/' -f3- | sed 's/[^a-z0-9_-]/__/gi')" >> $GITHUB_ENV
34+
35+
- name: Set up Docker Buildx
36+
id: buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Inspect Builder
40+
run: |
41+
echo "Name: ${{ steps.buildx.outputs.name }}"
42+
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
43+
echo "Status: ${{ steps.buildx.outputs.status }}"
44+
echo "Flags: ${{ steps.buildx.outputs.flags }}"
45+
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
46+
echo "DOCKER_TAG: ${{ env.DOCKER_TAG }}"
47+
48+
- name: Build the Docker Image; build and test vt-tv
49+
id: docker_build
50+
continue-on-error: false
51+
uses: docker/build-push-action@v6
52+
with:
53+
push: false
54+
tags: ${{ env.DOCKER_TAG }}
55+
context: .
56+
file: ./ci/docker/build-and-test.dockerfile
57+
build-args: |
58+
BASE_IMAGE=${{ env.DOCKER_REPOSITORY }}:${{ matrix.image }}
59+
VT_TV_TESTS_ENABLED=${{ env.VT_TV_TESTS_ENABLED }}
60+
VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }}
61+
outputs: type=local,dest=${{ env.OUTPUT_DIR }}
62+
63+
- name: Upload artifacts
64+
uses: actions/upload-artifact@v4
65+
if: always()
66+
with:
67+
name: vt-tv-Artifacts-${{ matrix.image }}
68+
path: ${{ env.OUTPUT_DIR }}
69+
70+
- name: Unit tests
71+
if: ${{ env.VT_TV_TESTS_ENABLED == 'ON' }}
72+
uses: phoenix-actions/test-reporting@v15
73+
with:
74+
name: Tests report
75+
path: ${{ env.OUTPUT_DIR }}/tmp/artifacts/junit-report.xml
76+
reporter: java-junit
77+
output-to: step-summary
78+
79+
- name: CCM Example output to summary
80+
if: ${{ (success() || failure()) && env.VT_TV_TESTS_ENABLED == 'ON' }}
81+
run: |
82+
echo '## CCM Example output' >> $GITHUB_STEP_SUMMARY
83+
if [ -f "${{ env.OUTPUT_DIR }}/tmp/artifacts/ccm_example0.png" ]; then
84+
echo '!'"[CCM Example](${{ env.OUTPUT_DIR }}/tmp/artifacts/ccm_example0.png)" >> $GITHUB_STEP_SUMMARY
85+
else
86+
echo 'Missing !' >> $GITHUB_STEP_SUMMARY
87+
fi
88+
89+
- name: Coverage summary
90+
if: ${{ (success() || failure()) && env.VT_TV_COVERAGE_ENABLED == 'ON' }}
91+
run: |
92+
echo '## Coverage' >> $GITHUB_STEP_SUMMARY
93+
echo '```shell' >> $GITHUB_STEP_SUMMARY
94+
cat ${{ env.OUTPUT_DIR }}/tmp/artifacts/lcov-list-report.txt >> $GITHUB_STEP_SUMMARY
95+
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/check-commit-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Check commit message format
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
1313
ref: ${{ github.event.pull_request.head.sha }}

.github/workflows/find-trailing-whitespace.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Find Trailing Whitespace
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
- uses: DARMA-tasking/find-trailing-whitespace@master
1212
with:
13-
exclude: "sketches;lib;docs"
13+
exclude: "sketches;lib;docs;.png$"
Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,73 @@
1-
name: Build dependencies and push base Docker Image to dockerhub
1+
name: Build & push base Docker image
22

3-
on: workflow_dispatch
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image:
7+
type: choice
8+
description: The configuration to build as a combination of os, compiler, vtk and python versions
9+
options:
10+
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8
11+
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8
12+
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
13+
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
414

515
jobs:
616
push_to_registry:
7-
name: Push Docker image to Docker Hub
17+
name: Build & Push
818
runs-on: ubuntu-latest
19+
env:
20+
DOCKER_REPOSITORY: lifflander1/vt
921
steps:
1022
- name: Check out the repo
11-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
1224

13-
- name: Log in to Docker Hub
14-
uses: docker/login-action@v2
15-
with:
16-
username: ${{ secrets.DOCKERHUB_USERNAME }}
17-
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
- name: Extract build configuration
26+
# If workflow dispatch event replace `matrix.image` by `inputs.image`
27+
run: |
28+
IFS='_-' read -r -a CONFIG <<< "${{ inputs.image }}"
29+
echo "BASE_IMAGE=${CONFIG[0]}:${CONFIG[1]}" >> $GITHUB_ENV
30+
echo "CC=${CONFIG[2]}-${CONFIG[3]}" >> $GITHUB_ENV
31+
if [[ "${CONFIG[2]}" == "gcc" ]]; then
32+
echo "CXX=g++-${CONFIG[3]}" >> $GITHUB_ENV
33+
echo "GCOV=gcov-${CONFIG[3]}" >> $GITHUB_ENV
34+
elif [[ "${CONFIG[2]}" == "clang" ]]; then
35+
echo "CXX=clang++-${CONFIG[3]}" >> $GITHUB_ENV
36+
echo "GCOV=gcov" >> $GITHUB_ENV
37+
else
38+
exit 1
39+
fi
40+
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
41+
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
42+
echo "DOCKER_TAG=${{ inputs.image }}" >> $GITHUB_ENV
1843
19-
- name: Extract metadata (tags, labels) for Docker
20-
id: meta
21-
uses: docker/metadata-action@v4
44+
- name: Build configuration
45+
run: |
46+
echo "Base image: $BASE_IMAGE"
47+
echo "C Compiler: $CC"
48+
echo "CXX Compiler: $CXX"
49+
echo "GCOV: $GCOV"
50+
echo "VTK: $VTK_VERSION"
51+
echo "Python: $PYTHON_VERSION"
52+
echo "Docker tag: $DOCKER_TAG"
53+
54+
- name: Log in to Docker Hub
55+
uses: docker/login-action@v3
2256
with:
23-
images: pierrpebay/vt-tv
57+
username: ${{ secrets.DOCKER_USERNAME }}
58+
password: ${{ secrets.DOCKER_TOKEN }}
2459

25-
- name: Build and push Docker image
26-
uses: docker/build-push-action@v4
60+
- name: Build and push to Docker Hub
61+
uses: docker/build-push-action@v6
2762
with:
2863
context: .
29-
file: ci/make-base-ubuntu22.04-gcc11-x64.dockerfile
64+
build-args: |
65+
BASE_IMAGE=${{ env.BASE_IMAGE }}
66+
CC=${{ env.CC }}
67+
CXX=${{ env.CXX }}
68+
GCOV=${{ env.GCOV }}
69+
VTK_VERSION=${{ env.VTK_VERSION }}
70+
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
71+
file: ci/docker/make-base.dockerfile
3072
push: true
31-
tags: ${{ steps.meta.outputs.tags }}
32-
labels: ${{ steps.meta.outputs.labels }}
73+
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
.*~undo-tree~
2+
.vscode/
3+
4+
# Items generated at build time
5+
/build
6+
/python-build
7+
output
8+
Testing

CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}")
3131

3232
option(VT_TV_PYTHON_BINDINGS_ENABLED "Build vt-tv with Python bindings" OFF)
3333
option(VT_TV_OPENMP_ENABLED "Build vt-tv with openMP support" ON)
34+
option(VT_TV_TESTS_ENABLED "Build vt-tv with unit tests" ON)
35+
option(VT_TV_COVERAGE_ENABLED "Build vt-tv with coverage" OFF)
3436

3537
# add -fPIC to all targets (if building with nanobind)
3638
if(VT_TV_PYTHON_BINDINGS_ENABLED)
@@ -49,6 +51,8 @@ endif()
4951

5052
add_definitions(-DVT_TV_N_THREADS=${VT_TV_N_THREADS})
5153
add_definitions(-DVT_TV_OPENMP_ENABLED=${VT_TV_OPENMP_ENABLED})
54+
add_compile_definitions(SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
55+
add_compile_definitions(BUILD_DIR="${CMAKE_BINARY_DIR}")
5256

5357
add_custom_target(vt_tv_examples)
5458
add_custom_target(vt_tv_tests)
@@ -61,24 +65,31 @@ set(PROJECT_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
6165
set(PROJECT_APP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/apps)
6266
set(PROJECT_BINDINGS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bindings)
6367

64-
include(CTest)
65-
6668
add_subdirectory(src)
6769
add_subdirectory(examples)
68-
add_subdirectory(tests)
70+
6971
add_subdirectory(apps)
7072
add_subdirectory(bindings)
7173

74+
include(CTest) #adds option BUILD_TESTING (default ON)
75+
76+
message(STATUS "VT_TV_COVERAGE_ENABLED: ${VT_TV_COVERAGE_ENABLED}")
77+
if (VT_TV_COVERAGE_ENABLED)
78+
add_compile_options(-fprofile-arcs -ftest-coverage -O0)
79+
add_link_options(-lgcov --coverage)
80+
endif()
81+
82+
message(STATUS "VT_TV_TESTS_ENABLED: ${VT_TV_TESTS_ENABLED}")
83+
if (BUILD_TESTING AND VT_TV_TESTS_ENABLED)
84+
set(CTEST_SOURCE_DIRECTORY ${SOURCE_DIR}/src)
85+
add_subdirectory(tests)
86+
endif()
87+
7288
configure_file(
7389
cmake/vtTVConfig.cmake.in
7490
"${PROJECT_BINARY_DIR}/vtTVConfig.cmake" @ONLY
7591
)
7692

77-
configure_file(
78-
${PROJECT_BASE_DIR}/cmake/cmake_config.h.in
79-
${PROJECT_BASE_DIR}/tests/unit/cmake_config.h @ONLY
80-
)
81-
8293
install(
8394
FILES "${PROJECT_BINARY_DIR}/vtTVConfig.cmake"
8495
DESTINATION cmake

0 commit comments

Comments
 (0)