Skip to content

Swap installation order of Trixi.jl and LibTrixi.jl #642

Swap installation order of Trixi.jl and LibTrixi.jl

Swap installation order of Trixi.jl and LibTrixi.jl #642

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- 'docs/**'
pull_request:
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- 'docs/**'
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: "false"
jobs:
test:
name: ${{ matrix.os }} - ${{ matrix.test_type }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
test_type:
- regular
- coverage
arch:
- x64
julia_version:
- '1.10'
t8code_version:
- '2.0.0'
include:
- os: ubuntu-latest
test_type: package-compiler
arch: x64
julia_version: '1.9.3' # 1.9.4: missing nghttp2 symbols in libcurl
t8code_version: '2.0.0'
env:
# Necessary for HDF5 to play nice with Julia
LD_PRELOAD: /lib/x86_64-linux-gnu/libcurl.so.4
# Necessary such that libtrixi will not use its own default for the depot path
JULIA_DEPOT_PATH: ~/.julia
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enable Julia cache
uses: julia-actions/cache@v1
- name: Enable t8code cache
id: cache-t8code
uses: actions/cache@v4
with:
path: ./t8code-local
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.t8code_version }}
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia_version }}
arch: ${{ matrix.arch }}
- name: Show Julia version information
run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)'
- name: Update `apt-get`
run: sudo apt-get update
- name: Install dependencies available with `apt-get`
# - MPI
# - HDF5
# - Google Test
# - Coverage (lcov)
run: |
sudo apt-get install -y openmpi-bin libopenmpi-dev \
libhdf5-openmpi-dev \
libgtest-dev \
lcov
- name: Install t8code
if: steps.cache-t8code.outputs.cache-hit != 'true'
run: |
T8CODE_RELEASE=${{ matrix.t8code_version }}
mkdir t8code-local
cd t8code-local
wget https://github.com/DLR-AMR/t8code/releases/download/v${T8CODE_RELEASE}/t8-${T8CODE_RELEASE}.tar.gz
tar xf t8-${T8CODE_RELEASE}.tar.gz
mkdir build
cd build
CC=mpicc CXX=mpicxx ../t8-${T8CODE_RELEASE}/configure \
--prefix=$PWD/../prefix --enable-mpi
make -j 2
make install
- name: Configure (test_type == 'regular')
if: ${{ matrix.test_type == 'regular' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Release \
-DT8CODE_PREFIX=$PWD/../t8code-local/prefix \
-DENABLE_TESTING=ON -DJULIA_PROJECT_PATH=../libtrixi-julia
- name: Configure (test_type == 'coverage')
if: ${{ matrix.test_type == 'coverage' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Debug \
-DT8CODE_PREFIX=$PWD/../t8code-local/prefix \
-DCMAKE_C_FLAGS="-cpp --coverage -O0" \
-DCMAKE_Fortran_FLAGS="-cpp --coverage -O0" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="--coverage" \
-DENABLE_TESTING=ON -DJULIA_PROJECT_PATH=../libtrixi-julia
- name: Build
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build
make -j 2
- name: Install
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build
make install
- name: Test building with an external Makefile
if: ${{ matrix.test_type == 'regular' }}
run: |
cd examples
make -f MakefileExternal LIBTRIXI_PREFIX=$PWD/../install
- name: Initialize project directory
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
# Note that we set the Julia depot to `~/.julia` *ONLY* to make use of the
# julia-actions/cache above (which unfortunately hardcoded the `~/.julia`
# directory). For this reason, we also need to use `--force`
# Still create subfolder `julia-depot`, which reflects the typical default
# and is tested below
run: |
mkdir libtrixi-julia
cd libtrixi-julia
mkdir julia-depot
../install/bin/libtrixi-init-julia .. \
--hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \
--t8code-library ../t8code-local/prefix/lib/libt8.so \
--julia-depot ~/.julia \
--force
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_tree1d_dgsem_advection_basic.jl .
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl .
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_t8code_2d_dgsem_advection_amr.jl .
- name: Initialize project directory (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
# Note that we set the Julia depot to `~/.julia` *ONLY* to make use of the
# julia-actions/cache above (which unfortunately hardcoded the `~/.julia`
# directory). For this reason, we also need to use `--force`
# Still create subfolder `julia-depot`, which reflects the typical default
# and is tested below
run: |
mkdir libtrixi-julia
cd libtrixi-julia
mkdir julia-depot
../utils/libtrixi-init-julia .. \
--hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \
--t8code-library ../t8code-local/prefix/lib/libt8.so \
--julia-depot ~/.julia \
--force
- name: Configure (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Debug \
-DUSE_PACKAGE_COMPILER=ON \
-DJULIA_PROJECT_PATH=$PWD/../libtrixi-julia
- name: Build (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
cd build
make -j2
- name: Test external CMake project
if: ${{ matrix.test_type == 'regular' }}
run: |
cd examples/external
./build.sh
mpirun -n 2 ./build/trixi_controller_simple_c \
../../libtrixi-julia \
../../LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl
env:
LIBTRIXI_DEBUG: all
- name: Prepare coverage reporting
if: ${{ matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
lcov --directory ../build --zerocounters
- name: Run Julia tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
uses: julia-actions/julia-runtest@v1
with:
coverage: ${{ matrix.test_type == 'coverage' }}
project: ./LibTrixi.jl
check_bounds: 'auto'
env:
LIBTRIXI_DEBUG: all
LD_PRELOAD: "" # Disable preloading libcurl.so since it does not work with the JLL-provided libhdf5.so
- name: Run examples
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
../build/examples/trixi_controller_simple_c . libelixir_tree1d_dgsem_advection_basic.jl
../build/examples/trixi_controller_simple_f . libelixir_tree1d_dgsem_advection_basic.jl
../build/examples/trixi_controller_simple_c . libelixir_p4est2d_dgsem_euler_sedov.jl
../build/examples/trixi_controller_simple_f . libelixir_p4est2d_dgsem_euler_sedov.jl
../build/examples/trixi_controller_data_c . libelixir_t8code_2d_dgsem_advection_amr.jl
../build/examples/trixi_controller_data_f . libelixir_t8code_2d_dgsem_advection_amr.jl
../build/examples/trixi_controller_t8code_c . libelixir_t8code_2d_dgsem_advection_amr.jl
env:
LIBTRIXI_DEBUG: all
- name: Run examples (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
cd build/examples
mpirun -n 2 trixi_controller_simple_c \
../../libtrixi-julia \
../../LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl
env:
LIBTRIXI_DEBUG: all
- name: Check error handling of examples
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
set +e # disable early exit on non-zero exit code
for command in "../build/examples/trixi_controller_simple_c" \
"../build/examples/trixi_controller_simple_c ." \
"../build/examples/trixi_controller_simple_f" \
"../build/examples/trixi_controller_simple_f ." \
"../build/examples/trixi_controller_data_c" \
"../build/examples/trixi_controller_data_c ." \
"../build/examples/trixi_controller_data_f" \
"../build/examples/trixi_controller_data_f ." \
"../build/examples/trixi_controller_t8code_c" \
"../build/examples/trixi_controller_t8code_c ."
do
$command
if [ $? -ne 2 ]; then
echo "Wrong exit code for $command! Expected 2, got $?"
exit 1
fi
done
env:
LIBTRIXI_DEBUG: all
- name: Run C tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build/test/c
ctest -V
env:
LIBTRIXI_DEBUG: all
GTEST_COLOR: 'yes'
- name: Run Fortran tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build/test/fortran
ctest -V
env:
LIBTRIXI_DEBUG: all
- name: Process Julia coverage data
if: ${{ matrix.test_type == 'coverage' }}
uses: julia-actions/julia-processcoverage@v1
with:
directories: LibTrixi.jl/src
- name: Process C/Fortran coverage data
if: ${{ matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
lcov --directory ../build --capture \
--exclude "*/julia.h" --exclude "*test-drive-src*" --exclude "*/test/*" \
--output-file lcov.info
- name: Upload coverage data (Codecov)
uses: codecov/codecov-action@v4
if: ${{ matrix.test_type == 'coverage' }}
with:
files: ./libtrixi-julia/lcov.info,./lcov.info
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage data (Coveralls)
if: ${{ matrix.test_type == 'coverage' }}
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: ./libtrixi-julia/lcov.info ./lcov.info
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session for debugging
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15