Skip to content

Commit

Permalink
#97: update vtk cache to keep both vtk source and build in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tlamonthezie committed Aug 28, 2024
1 parent 2367be2 commit c299dfa
Showing 1 changed file with 106 additions and 102 deletions.
208 changes: 106 additions & 102 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ jobs:
matrix:
os: [ macos-latest ]
vtk_version: [ 9.3.1 ]
compiler: [
[gcc-12, g++-12, gcov-12]
]
# compiler: [
# [gcc-12, g++-12, gcov-12]
# ]
runs-on: ${{ matrix.os }}
name: vt-tv build and test
env:
VTK_DIR: /opt/build/vtk
VTK_SRC_DIR: /opt/src/vtk
VTK_BUILD_DIR: /opt/build/vtk
VTK_CACHE_KEY: ${{ matrix.os }}-vtk-${{ matrix.vtk_version }}
VT_TV_BUILD_DIR: /opt/build/vt-tv
VT_TV_TESTS_ENABLED: "ON"
VT_TV_COVERAGE_ENABLED: "ON"
Expand All @@ -31,27 +33,29 @@ jobs:
- name: Install dependencies
run: |
brew update && brew install coreutils lcov && brew install xquartz --cask
echo $(whoami)
sudo mkdir -p /opt/build
sudo chown -R $(whoami) /opt/build
- name: Set up cache
- name: Set folder permissions
run: |
sudo mkdir -p ${{ env.VTK_SRC_DIR }}
sudo chown -R $(whoami) ${{ env.VTK_SRC_DIR }}
sudo mkdir -p ${{ env.VTK_BUILD_DIR }}
sudo chown -R $(whoami) ${{ env.VTK_BUILD_DIR }}
- name: Load VTK from cache
id: vtk-cache
uses: actions/cache@v3
with:
path: ${{ env.VTK_DIR }}
key: ${{ matrix.os }}-vtk-build-${{ matrix.vtk_version }}
path: |
${{ env.VTK_SRC_DIR }}
${{ env.VTK_BUILD_DIR }}
key: ${{ env.VTK_CACHE_KEY }}

- name: Build VTK
id: cache-vtk-build
- name: Setup VTK ${{ matrix.vtk_version }}
if: ${{steps.vtk-cache.outputs.cache-hit != 'true'}}
run: |
sudo mkdir -p /opt/src/vtk
sudo git clone --recursive --branch v${{ matrix.vtk_version }} https://gitlab.kitware.com/vtk/vtk.git /opt/src/vtk
sudo mkdir -p ${{ env.VTK_DIR }}
cd ${{ env.VTK_DIR }}
sudo cmake \
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 \
Expand All @@ -61,87 +65,87 @@ jobs:
-DVTK_USE_SDL2:BOOL=OFF \
-DVTK_Group_Rendering:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON \
-S /opt/src/vtk -B ${{ env.VTK_DIR }}
sudo cmake --build ${{ env.VTK_DIR }} -j$(sysctl -n hw.logicalcpu)
- name: Build
run: |
cd ${{ github.workspace }}
sudo chmod +x ./ci/build.sh
sudo \
VTK_DIR=${{ env.VTK_DIR }} \
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 }} \
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 }}
-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 }} \
# 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 }} \
# 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 }}

0 comments on commit c299dfa

Please sign in to comment.