Skip to content

#97: try a fix in ci #39

#97: try a fix in ci

#97: try a fix in ci #39

name: Build and Test (macos)
# Trigger the workflow on push or pull request
on:
push:
branches:
- 97-add-more-environments-to-test-in-ci
jobs:
build:
strategy:
fail-fast: false
matrix:
host: [
{ os: macos-latest, compiler: { name: clang, cc: clang, cxx: clang++ }, gcov: gcov },
{ os: macos-latest, compiler: { name: gcc12, cc: gcc-12, cxx: g++-12 }, gcov: gcov-12 }
]
vtk_version: [ 9.3.1 ]
runs-on: ${{ matrix.host.os }}
name: vt-tv build and test
env:
VTK_SRC_DIR: /opt/src/vtk
VTK_BUILD_DIR: /opt/build/vtk
VTK_CACHE_KEY: ${{ matrix.host.os }}-${{ matrix.host.compiler.name }}-vtk-${{ matrix.vtk_version }}
VT_TV_BUILD_DIR: /opt/build/vt-tv
VT_TV_TESTS_ENABLED: "ON"
VT_TV_COVERAGE_ENABLED: "ON"
VT_TV_OUTPUT_DIR: /var/vt-tv/output
VT_TV_ARTIFACTS_DIR: /tmp/artifacts
CC: ~
CXX: ~
steps:
- uses: actions/checkout@v4
- name: Set folder permissions
run: |
sudo mkdir -p ${{ env.VTK_SRC_DIR }} ${{ env.VTK_BUILD_DIR }}
sudo chown -R $(whoami) ${{ env.VTK_SRC_DIR }} ${{ env.VTK_BUILD_DIR }}
- name: Set environment variables
run: |
echo "CC=$(which ${{ matrix.host.compiler.cc }})" >> $GITHUB_ENV
echo "CXX=$(which ${{ matrix.host.compiler.cc }})" >> $GITHUB_ENV
- name: Install dependencies
run: |
brew update && brew install coreutils lcov && brew install xquartz --cask
- name: Load VTK from cache
id: vtk-cache
uses: actions/cache@v3
with:
path: |
${{ env.VTK_SRC_DIR }}
${{ env.VTK_BUILD_DIR }}
key: ${{ env.VTK_CACHE_KEY }}
- name: Setup VTK ${{ matrix.vtk_version }}
if: ${{steps.vtk-cache.outputs.cache-hit != 'true'}}
run: |
git clone --recursive --branch v${{ matrix.vtk_version }} https://gitlab.kitware.com/vtk/vtk.git ${{ env.VTK_SRC_DIR }}
cd ${{ env.VTK_SRC_DIR }}
cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=OFF \
-DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \
-DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=OFF \
-DVTK_USE_X:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=ON \
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S /opt/src/vtk -B ${{ env.VTK_BUILD_DIR }}
cmake --build ${{ env.VTK_BUILD_DIR }} -j$(nproc)
# - name: Build
# run: |
# cd ${{ github.workspace }}
# chmod +x ./ci/build.sh
# VTK_DIR=${{ env.VTK_BUILD_DIR }} \
# CC="${{ env.CC }}" \
# CXX="${{ env.CXX }}" \
# VT_TV_BUILD_DIR=${{ env.VT_TV_BUILD_DIR }} \
# VT_TV_TESTS_ENABLED=${{ env.VT_TV_TESTS_ENABLED }} \
# VT_TV_COVERAGE_ENABLED=${{ env.VT_TV_COVERAGE_ENABLED }} \
# GCOV=${{ matrix.host.gcov }}
# VT_TV_PYTHON_BINDINGS_ENABLED=OFF \
# VT_TV_WERROR_ENABLED=ON \
# ./build.sh
# - name: Test
# run: |
# cd ${{ github.workspace }}
# sudo \
# VT_TV_BUILD=OFF \
# VT_TV_RUN_TESTS=ON \
# VT_TV_BUILD_DIR=${{ env.VT_TV_BUILD_DIR }}
# ./build.sh
# - name: Build and Test Python bindings
# run: |
# # TODO: add conda
# # Activate conda environment
# # . /opt/conda/etc/profile.d/conda.sh && conda activate deves
# # Build
# # pip install PyYAML
# # pip install .
# # Test
# # python ./tests/test_bindings.py
# - name: Collect artifacts
# run: |
# # Add artifacts
# mkdir -p ${{ env.VT_TV_ARTIFACTS_DIR }}
# # > go to output directory
# pushd ${{ env.VT_TV_OUTPUT_DIR }}
# # > add the unit tests report artifact
# cp "junit-report.xml" ${{ env.VT_TV_ARTIFACTS_DIR }}/ || true
# # > add mesh files and png artifacts
# if [ -d "${{ env.VT_TV_OUTPUT_DIR }}" ]; then
# cp "${{ env.VT_TV_OUTPUT_DIR }}/"*".vtp" ${{ env.VT_TV_ARTIFACTS_DIR }}/
# cp "${{ env.VT_TV_OUTPUT_DIR }}/"*".png" ${{ env.VT_TV_ARTIFACTS_DIR }}/
# fi
# if [[ "${{ env.VT_TV_COVERAGE_ENABLED }}" == "ON" ]]; then
# # > add `coverage --list` file artifact
# lcov --list lcov_vt-tv_test_no_deps.info > ${{ env.VT_TV_ARTIFACTS_DIR }}/lcov-list-report.txt
# # > 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
# # list artifacts dir content
# ls ${{ env.VT_TV_ARTIFACTS_DIR }}
# - 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
# path: ${{ env.VT_TV_ARTIFACTS_DIR }}