#97: fix typo #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
# 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: | |
os: [ macos-latest ] | |
vtk_version: [ 9.3.1 ] | |
compiler: [ | |
[gcc-12, g++-12, gcov-12] | |
] | |
runs-on: ${{ matrix.os }} | |
name: vt-tv build and test | |
env: | |
VTK_DIR: /opt/build/vtk | |
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 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
brew update && brew install coreutils lcov xquartz --cask | |
- name: Set up cache | |
id: vtk-cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.VTK_DIR }} | |
key: ${{ matrix.os }}-vtk-build-${{ matrix.vtk_version }} | |
- name: Build VTK | |
id: cache-vtk-build | |
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 \ | |
-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_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 }} |