Skip to content

Commit

Permalink
Merge commit '8229063b6a7c0f658c443eb62bbf8ccd8dbddf22' into 61-creat…
Browse files Browse the repository at this point in the history
…e-configuration-validator
  • Loading branch information
maxime-bfsquall committed Sep 26, 2024
2 parents 5c68eb5 + 8229063 commit 57bb67c
Show file tree
Hide file tree
Showing 32 changed files with 1,033 additions and 306 deletions.
184 changes: 184 additions & 0 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
name: Build and Test (macos)

# Trigger the workflow on push or pull request
on:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize, converted_to_draft, ready_for_review]

jobs:
build:
strategy:
fail-fast: false
matrix:
host: [
{
base: macos-12,
compiler: { cc: clang, cxx: clang++ },
gcov: llvm-gcov,
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1'
},
{
base: macos-13,
compiler: { cc: clang, cxx: clang++ },
gcov: llvm-gcov,
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1'
},
{
base: macos-14,
compiler: { cc: clang, cxx: clang++ },
gcov: llvm-gcov,
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1'
}
]
runs-on: ${{ matrix.host.base }}
name: vt-tv build and test (${{ matrix.host.base }}, ${{ matrix.host.compiler.cc }}, vtk-${{ matrix.host.vtk }}, py[${{ join(matrix.host.python, ', ') }}])
env:
VTK_SRC_DIR: /opt/src/vtk
VTK_BUILD_DIR: /opt/build/vtk
CACHE_KEY: ${{ matrix.host.base }}-${{ matrix.host.compiler.cc }}-vtk-${{ matrix.host.vtk }}
VT_TV_BUILD_DIR: /opt/build/vt-tv
VT_TV_TESTS_ENABLED: "ON"
VT_TV_COVERAGE_ENABLED: ${{ matrix.host.compiler.gcov == '' && 'OFF' || 'ON' }}
VT_TV_OUTPUT_DIR: ${{ github.workspace }}/output
VT_TV_TESTS_OUTPUT_DIR: ${{ github.workspace }}/output/tests
VT_TV_ARTIFACTS_DIR: /tmp/artifacts
CONDA_PATH: /opt/conda
CC: ~
CXX: ~
GCOV: ~
steps:
- uses: actions/checkout@v4

- name: Set folder permissions
run: |
sudo chown -R $(whoami) /opt
mkdir -p ${{ env.VTK_SRC_DIR }} ${{ env.VT_TV_BUILD_DIR }}
- name: Set environment variables
run: |
echo "CC=$(which ${{ matrix.host.compiler.cc }})" >> $GITHUB_ENV
echo "CXX=$(which ${{ matrix.host.compiler.cxx }})" >> $GITHUB_ENV
echo "GCOV=$(which ${{ matrix.host.gcov }})" >> $GITHUB_ENV
- name: Install dependencies
run: |
brew update && brew install coreutils lcov xquartz
- name: Load cache (VTK, Miniconda3)
id: base-cache
uses: actions/cache@v4
with:
path: |
${{ env.VTK_SRC_DIR }}
${{ env.VTK_BUILD_DIR }}
${{ env.CONDA_PATH }}
~/.zshrc
~/.bash_profile
key: ${{ env.CACHE_KEY }}
save-always: true

- name: Setup Conda
if: ${{steps.base-cache.outputs.cache-hit != 'true'}}
run: |
sudo CONDA_PATH=${{ env.CONDA_PATH }} bash ./ci/setup_conda.sh ${{ join(matrix.host.python) }}
- name: Reload shell variables
run: |
if [ -f ~/.zshrc ]; then . ~/.zshrc; fi
if [ -f ~/.profile ]; then . ~/.profile; fi
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
which conda
conda --version
conda env list
- name: Setup VTK ${{ matrix.host.vtk }}
if: ${{steps.base-cache.outputs.cache-hit != 'true'}}
run: |
VTK_DIR=${{ env.VTK_BUILD_DIR }} VTK_SRC_DIR=${{ env.VTK_SRC_DIR }} bash ./ci/setup_vtk.sh
- name: Build
run: |
mkdir -p ${{ env.VT_TV_BUILD_DIR }}
CC="${{ env.CC }}" \
CXX="${{ env.CXX }}" \
VTK_DIR="${{ env.VTK_BUILD_DIR }}" \
VT_TV_BUILD_DIR="${{ env.VT_TV_BUILD_DIR }}" \
VT_TV_CLEAN=OFF \
VT_TV_TESTS_ENABLED=${{ env.VT_TV_TESTS_ENABLED }} \
VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }} \
GCOV="${{ env.GCOV }}" \
VT_TV_PYTHON_BINDINGS_ENABLED=OFF \
VT_TV_WERROR_ENABLED=ON \
bash ./build.sh
- name: Test
run: |
VTK_DIR=${{ env.VTK_BUILD_DIR }} \
VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }} \
VT_TV_OUTPUT_DIR="${{ env.VT_TV_OUTPUT_DIR }}" \
bash ./ci/test.sh
- name: Build Python package (${{ join(matrix.host.python, ', ') }})
run: |
VTK_DIR=${{ env.VTK_BUILD_DIR }} bash ./ci/python_build.sh
- name: Test Python bindings (${{ join(matrix.host.python) }})
run: |
VTK_DIR=${{ env.VTK_BUILD_DIR }} bash ./ci/python_test.sh
- name: Collect artifacts
run: |
mkdir -p ${{ env.VT_TV_ARTIFACTS_DIR }}
# > go to output directory
pushd ${{ env.VT_TV_OUTPUT_DIR }}
echo "> add junit test report artifact"
cp "junit-report.xml" ${{ env.VT_TV_ARTIFACTS_DIR }}/ || true
if [[ "${{ env.VT_TV_COVERAGE_ENABLED }}" == "ON" ]]; then
echo "> add `coverage --list` file artifact"
lcov --list lcov_vt-tv_test_no_deps.info > ${{ env.VT_TV_ARTIFACTS_DIR }}/lcov-list-report.txt
echo "> add total lines coverage file artifact (percentage of lines covered)"
# might be useful for generating later a badge in ci
LCOV_SUMMARY=$(lcov --summary lcov_vt-tv_test_no_deps.info)
LCOV_TOTAL_LINES_COV=$(echo $LCOV_SUMMARY | grep -E -o 'lines......: ([0-9.]+)*' | grep -o -E '[0-9]+.[0-9]+')
echo $LCOV_TOTAL_LINES_COV > lcov-lines-total.txt
cp lcov-lines-total.txt ${{ env.VT_TV_ARTIFACTS_DIR }}/
fi
popd
echo "> add tests output mesh files and png artifacts"
if [ -d "${{ env.VT_TV_TESTS_OUTPUT_DIR }}" ]; then
cp "${{ env.VT_TV_TESTS_OUTPUT_DIR }}/"*".vtp" ${{ env.VT_TV_ARTIFACTS_DIR }}/ || true
cp "${{ env.VT_TV_TESTS_OUTPUT_DIR }}/"*".png" ${{ env.VT_TV_ARTIFACTS_DIR }}/ || true
fi
echo "> list of collected artifacts:"
pushd ${{ env.VT_TV_ARTIFACTS_DIR }}
find ${{ env.VT_TV_ARTIFACTS_DIR }} | while read line; do echo "- $line"; done
popd
- name: Unit tests
if: ${{ env.VT_TV_TESTS_ENABLED == 'ON' }}
uses: phoenix-actions/test-reporting@v15
with:
name: Tests report
path: ${{ env.VT_TV_ARTIFACTS_DIR }}/junit-report.xml
reporter: java-junit
output-to: step-summary

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: vt-tv-artifacts-${{ env.CACHE_KEY }}
path: ${{ env.VT_TV_ARTIFACTS_DIR }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test
name: Build and Test (ubuntu)

# Trigger the workflow on push or pull request
on:
Expand All @@ -14,17 +14,43 @@ jobs:
strategy:
fail-fast: false
matrix:
image:
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
host: [
{
base: ubuntu-22.04,
compiler: { cc: gcc-11 },
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.2.2',
image: ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.all
},
{
base: ubuntu-22.04,
compiler: { cc: clang-11 },
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.2.2',
image: ubuntu_22.04-clang_11-vtk_9.2.2-py_3.all
},
{
base: ubuntu-22.04,
compiler: { cc: gcc-12 },
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.0',
image: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.all
},
{
base: ubuntu-24.04,
compiler: { cc: gcc-13 },
python: ['3.8', '3.9', '3.10', '3.11', '3.12'],
vtk: '9.3.1',
image: ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.all
}
]
env:
OUTPUT_DIR: '/tmp/artifacts'
VT_TV_TESTS_ENABLED: 'ON' # Build & Test in all configurations
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
VT_TV_PYTHON_BINDINGS_ENABLED: 'ON'
VT_TV_TESTS_ENABLED: 'ON'
VT_TV_COVERAGE_ENABLED: ${{ matrix.host.image == 'ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.all' && 'ON' || 'OFF' }} # Coverage only with main test image
DOCKER_REPOSITORY: lifflander1/vt
name: vt-tv build and test
DOCKER_TAG: ~
name: vt-tv build and test (${{ matrix.host.base }}, ${{ matrix.host.compiler.cc }}, vtk-${{ matrix.host.vtk }}, py[${{ join(matrix.host.python, ', ') }}])
steps:
- uses: actions/checkout@v4

Expand All @@ -51,11 +77,11 @@ jobs:
uses: docker/build-push-action@v6
with:
push: false
tags: ${{ env.DOCKER_TAG }}
# tags: ${{ env.DOCKER_TAG }}
context: .
file: ./ci/docker/build-and-test.dockerfile
file: ./ci/docker/build-and-test-ubuntu.dockerfile
build-args: |
BASE_IMAGE=${{ env.DOCKER_REPOSITORY }}:${{ matrix.image }}
BASE_IMAGE=${{ env.DOCKER_REPOSITORY }}:${{ matrix.host.image }}
VT_TV_TESTS_ENABLED=${{ env.VT_TV_TESTS_ENABLED }}
VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }}
outputs: type=local,dest=${{ env.OUTPUT_DIR }}
Expand All @@ -64,7 +90,7 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: vt-tv-Artifacts-${{ matrix.image }}
name: vt-tv-Artifacts-${{ matrix.host.image }}
path: ${{ env.OUTPUT_DIR }}

- name: Unit tests
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/pushbasedockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@ on:
inputs:
image:
type: choice
description: The configuration to build as a combination of os, compiler, vtk and python versions
description: The configuration to build as a combination of os, compiler, vtk
options:
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8
- ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.all
- ubuntu_22.04-clang_11-vtk_9.2.2-py_3.all
- ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.all
- ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.all
default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.all

jobs:
push_to_registry:
name: Build & Push
runs-on: ubuntu-latest
env:
DOCKER_REPOSITORY: lifflander1/vt
DOCKER_TAG: ~
BASE_IMAGE: ~
CXX: ~
CC: ~
GCOV: ~
VTK_VERSION: ~
PYTHON_VERSIONS: ~
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -38,7 +46,11 @@ jobs:
exit 1
fi
echo "VTK_VERSION=${CONFIG[5]}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${CONFIG[7]}" >> $GITHUB_ENV
if [[ "${CONFIG[7]}" == "3.all" ]]; then
echo "PYTHON_VERSIONS=3.8,3.9,3.10,3.11,3.12" >> $GITHUB_ENV
else
echo "PYTHON_VERSIONS=${CONFIG[7]}" >> $GITHUB_ENV
fi
echo "DOCKER_TAG=${{ inputs.image }}" >> $GITHUB_ENV
- name: Build configuration
Expand All @@ -48,7 +60,7 @@ jobs:
echo "CXX Compiler: $CXX"
echo "GCOV: $GCOV"
echo "VTK: $VTK_VERSION"
echo "Python: $PYTHON_VERSION"
echo "Python: $PYTHON_VERSIONS"
echo "Docker tag: $DOCKER_TAG"
- name: Log in to Docker Hub
Expand All @@ -67,7 +79,7 @@ jobs:
CXX=${{ env.CXX }}
GCOV=${{ env.GCOV }}
VTK_VERSION=${{ env.VTK_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
file: ci/docker/make-base.dockerfile
PYTHON_VERSIONS=${{ env.PYTHON_VERSIONS }}
file: ci/docker/base-ubuntu.dockerfile
push: true
tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}"
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ set(VT_TV_N_THREADS "2" CACHE STRING "Number of OpenMP threads to use")

include(cmake/load_packages.cmake)

if(APPLE)
if(APPLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-ffat-lto-objects)
endif()

Expand Down Expand Up @@ -78,7 +78,7 @@ include(CTest) #adds option BUILD_TESTING (default ON)
message(STATUS "VT_TV_COVERAGE_ENABLED: ${VT_TV_COVERAGE_ENABLED}")
if (VT_TV_COVERAGE_ENABLED)
add_compile_options(-fprofile-arcs -ftest-coverage -O0)
add_link_options(-lgcov --coverage)
add_link_options(--coverage)
endif()

message(STATUS "VT_TV_TESTS_ENABLED: ${VT_TV_TESTS_ENABLED}")
Expand Down
Loading

0 comments on commit 57bb67c

Please sign in to comment.