Skip to content

Github actions workflow fix #4

Github actions workflow fix

Github actions workflow fix #4

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- '1.11'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- name: Setup Julia environment
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
pkg-config \
libhepmc3-dev \
python3-dev \
libclang-dev \
clang \
llvm-dev
- name: Cache Julia packages
uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: ${{ runner.os }}-test-${{ env.cache-name }}-
- name: Setup Julia project and install dependencies
run: |
julia --project=. -e "
using Pkg
Pkg.instantiate()
# Install additional required packages
Pkg.add([\"CxxWrap\", \"WrapIt\"])
# Load to trigger any builds
using CxxWrap
using WrapIt
WrapIt.install()
"
- name: Find Julia's libclang and setup environment
run: |
echo "=== Setting up libclang environment ==="
# Find Julia's libclang
JULIA_DEPOT=$(julia -e "println(first(DEPOT_PATH))")
echo "Julia depot: $JULIA_DEPOT"
# Search for libclang in Julia's artifacts
LIBCLANG_PATH=$(find $JULIA_DEPOT -name "libclang*.so*" 2>/dev/null | head -1)
if [ -n "$LIBCLANG_PATH" ]; then
LIBCLANG_DIR=$(dirname "$LIBCLANG_PATH")
echo "Found Julia's libclang at: $LIBCLANG_PATH"
echo "Libclang directory: $LIBCLANG_DIR"
# Add to LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=$LIBCLANG_DIR:$LD_LIBRARY_PATH" >> $GITHUB_ENV
# Also try to symlink to system location
sudo ln -sf "$LIBCLANG_PATH" /usr/lib/libclang.so 2>/dev/null || true
sudo ln -sf "$LIBCLANG_PATH" /usr/lib/x86_64-linux-gnu/libclang.so 2>/dev/null || true
else
echo "Julia's libclang not found, using system libclang"
# Ensure system libclang is available
sudo apt-get install -y libclang-19-dev || sudo apt-get install -y libclang-dev
fi
# Export LD_LIBRARY_PATH for current session
export LD_LIBRARY_PATH="$LIBCLANG_DIR:$LD_LIBRARY_PATH"
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
# Check what libclang libraries are available
echo "=== Available libclang libraries ==="
find /usr/lib* -name "*libclang*" 2>/dev/null || echo "No system libclang found"
find $JULIA_DEPOT -name "*libclang*" 2>/dev/null || echo "No Julia libclang found"
# Check if we can find the specific version
ls -la /usr/lib*/libclang* 2>/dev/null || echo "No system libclang details"
- name: Find and install WrapIt executable
run: |
# Export the library path from previous step
JULIA_DEPOT=$(julia -e "println(first(DEPOT_PATH))")
LIBCLANG_PATH=$(find $JULIA_DEPOT -name "libclang*.so*" 2>/dev/null | head -1)
if [ -n "$LIBCLANG_PATH" ]; then
LIBCLANG_DIR=$(dirname "$LIBCLANG_PATH")
export LD_LIBRARY_PATH="$LIBCLANG_DIR:$LD_LIBRARY_PATH"
fi
echo "=== Searching for WrapIt executable ==="
# Search for wrapit executable
find $JULIA_DEPOT -name "wrapit*" -type f 2>/dev/null || echo "No wrapit found in depot"
find ~/.julia -name "wrapit*" -type f 2>/dev/null || echo "No wrapit found in ~/.julia"
# Try to get path from WrapIt module
WRAPIT_PATH=$(julia --project=. -e "
using WrapIt
# Search in WrapIt package directory
pkg_dir = dirname(dirname(pathof(WrapIt)))
println(\"Searching in: \", pkg_dir)
for (root, dirs, files) in walkdir(pkg_dir)
for file in files
if startswith(file, \"wrapit\") && isfile(joinpath(root, file))
println(joinpath(root, file))
exit()
end
end
end
" 2>/dev/null || echo "Could not find WrapIt via Julia search")
echo "WrapIt path candidate: $WRAPIT_PATH"
# Manual search and install
if [ -n "$WRAPIT_PATH" ] && [ -f "$WRAPIT_PATH" ]; then
echo "Found WrapIt at: $WRAPIT_PATH"
sudo cp "$WRAPIT_PATH" /usr/bin/wrapit
sudo chmod +x /usr/bin/wrapit
else
echo "=== Manual WrapIt search ==="
FOUND_WRAPIT=$(find $JULIA_DEPOT ~/.julia -name "wrapit*" -type f -executable 2>/dev/null | head -1)
if [ -n "$FOUND_WRAPIT" ]; then
echo "Found WrapIt executable: $FOUND_WRAPIT"
sudo cp "$FOUND_WRAPIT" /usr/bin/wrapit
sudo chmod +x /usr/bin/wrapit
else
echo "❌ Could not find WrapIt executable"
exit 1
fi
fi
# Test WrapIt with proper library path
echo "=== Testing WrapIt installation ==="
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
which wrapit
# Try to run wrapit with library path
LD_LIBRARY_PATH="$LD_LIBRARY_PATH" wrapit --version || echo "WrapIt installed but version check failed"
# Create a wrapper script that sets the environment
sudo tee /usr/bin/wrapit-with-env > /dev/null << EOF
#!/bin/bash
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"

Check failure on line 171 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

You have an error in your yaml syntax on line 171
exec /usr/bin/wrapit "\$@"
EOF
sudo chmod +x /usr/bin/wrapit-with-env
- name: Clean and rebuild bindings from scratch
run: |
# Set up environment
JULIA_DEPOT=$(julia -e "println(first(DEPOT_PATH))")
LIBCLANG_PATH=$(find $JULIA_DEPOT -name "libclang*.so*" 2>/dev/null | head -1)
if [ -n "$LIBCLANG_PATH" ]; then
LIBCLANG_DIR=$(dirname "$LIBCLANG_PATH")
export LD_LIBRARY_PATH="$LIBCLANG_DIR:$LD_LIBRARY_PATH"
fi
cd gen
rm -rf build/ cpp/jlHepMC3.* jl/
# Modify build.jl to use the wrapper script or set environment
sed -i 's|`wrapit |`env LD_LIBRARY_PATH="'"$LD_LIBRARY_PATH"'" wrapit |g' build.jl
# Use the project environment when running build.jl
julia --project=.. build.jl
- name: Apply manual wrapper patches
run: |
# Apply the patches to include manual wrappers
sed -i '/#include "HepMC3\/Units.h"/a #include "HepMC3Wrap.h"' gen/cpp/jlHepMC3.cxx
sed -i '/for(const auto& w: wrappers) w->add_methods();/a \ add_manual_hepmc3_methods(jlModule);' gen/cpp/jlHepMC3.cxx
# Verify patches were applied
echo "=== Checking if patches were applied ==="
grep -n "HepMC3Wrap.h" gen/cpp/jlHepMC3.cxx || echo "❌ HepMC3Wrap.h not found"
grep -n "add_manual_hepmc3_methods" gen/cpp/jlHepMC3.cxx || echo "❌ add_manual_hepmc3_methods not found"
- name: Rebuild with manual wrappers
run: |
cd gen/build
cmake --build . --config Release --parallel 8
- name: Test basic example
run: |
julia --project=. examples/basic_tree_julia.jl
- name: Run test suite
run: |
julia --project=. -e "
using Pkg
Pkg.test()
"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.version }}
path: |
gen/build/
examples/
test/