Skip to content

Fix calorimetry

Fix calorimetry #1830

Workflow file for this run

# This is a simple workflow to run unit tests and code coverage
name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push and PRs
push:
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-codeclimate-credentials:
name: Check CodeClimate credentials
runs-on: ubuntu-22.04
outputs:
has_credentials: ${{ steps.setvar.outputs.has_credentials }}
steps:
- name: Check secrets
id: setvar
run: |
if [[ "${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}" != "" ]]; \
then
echo "Credentials to access CodeClimate found"
echo has_credentials="true" >> $GITHUB_OUTPUT
else
echo "Credentials to access CodeClimate not found"
echo has_credentials="false" >> $GITHUB_OUTPUT
fi
build-icetray:
name: Unit tests - IceTray (v1.13.0 - 3.10)
needs: [ check-codeclimate-credentials ]
runs-on: ubuntu-22.04
strategy:
matrix:
torch_version: ['2.7.0']
hardware: ["cpu"]
container:
# GitHub Actions overwrite the docker container entrypoint
# inspect <image> --format '{{.Config.Entrypoint}}'
image: icecube/icetray:icetray-devel-v1.13.0-ubuntu22.04-2025-02-12
steps:
- name: Mimmick Docker Entrypoint
# The entrypoint of the container sets python paths
# Because the entrypoint is skipped by GitHub, we set it here
run: |
echo "I3_SRC=/opt/icetray/share/icetray" >> $GITHUB_ENV
echo "I3_BUILD=/opt/icetray/share/icetray" >> $GITHUB_ENV
echo "I3_TESTDATA=/root/icetray/build/test-data" >> $GITHUB_ENV
echo "I3_PRODDATA=/root/icetray/build/prod-data" >> $GITHUB_ENV
echo "ROOTSYS=/opt/icetray/cernroot" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PYTHONPATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:$PYTHONPATH" >> $GITHUB_ENV
echo "PATH=/opt/icetray/bin:$PATH" >> $GITHUB_ENV
echo "HDF5_USE_FILE_LOCKING=FALSE" >> $GITHUB_ENV
- name: Verify IceCube is importable
run: python3 -c "import icecube; print('Import Successful')"
- name: Show python version
run: |
python3 --version
pip --version
pip3 list
python3 -c "import icecube; print(icecube.__path__)"
pip show setuptools
- name: Install git
run: |
apt-get --yes install sudo
sudo apt update --fix-missing --yes
sudo apt upgrade --yes
sudo apt-get install --yes git
- uses: actions/checkout@v4
- name: Create virtual environment
shell: bash
run: |
python3 -m venv ~/venv --upgrade-deps
source ~/venv/bin/activate
pip --version
python --version
pip show setuptools
- name: Print available disk space before graphnet install
run: df -h
- name: Upgrade packages in virtual environment
shell: bash
run: |
source ~/venv/bin/activate
pip install --upgrade astropy
pip install --upgrade PyYAML
pip install --upgrade psutil
pip install --upgrade setuptools
pip install --upgrade versioneer
pip show setuptools
pip show versioneer
- name: Install package
uses: ./.github/actions/install
with:
editable: true
use_vm: true
torch_version: ${{ matrix.torch_version }}
hardware: ${{ matrix.hardware }}
- name: Print packages in pip
shell: bash
run: |
source ~/venv/bin/activate
pip show torch
pip show torch-geometric
pip show torch-cluster
pip show torch-sparse
pip show torch-scatter
pip show jammy_flows
- name: Run unit tests and generate coverage report
shell: bash
run: |
source ~/venv/bin/activate
coverage run --source=graphnet -m pytest tests/ --ignore=tests/examples/04_training --ignore=tests/utilities
coverage run -a --source=graphnet -m pytest tests/examples/04_training
coverage run -a --source=graphnet -m pytest tests/utilities
coverage xml -o coverage.xml
coverage report -m
- name: Work around permission issue
run: |
git config --global --add safe.directory /__w/graphnet/graphnet
- name: Publish code coverage
uses: paambaati/codeclimate-action@v9.0.0
if: needs.check-codeclimate-credentials.outputs.has_credentials == 'true'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
with:
coverageLocations: coverage.xml:coverage.py
build-matrix-examples:
name: Examples - Ubuntu 22.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.11']
torch_version: ['2.7.0', '2.6.0', '2.5.0']
hardware: ["cpu"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Print available disk space before graphnet install
run: df -h
- name: Show existing environment
run: |
echo "PIP_FLAGS=${PIP_FLAGS}"
python --version
pip --version
pip debug --verbose
- name: Install package
uses: ./.github/actions/install
with:
editable: true
torch_version: ${{ matrix.torch_version }}
hardware: ${{ matrix.hardware }}
- name: Print available disk space after graphnet install
run: df -h
- name: Print packages in pip
run: |
pip show torch
pip show torch-geometric
pip show torch-cluster
pip show torch-sparse
pip show torch-scatter
pip show dill
pip show numpy
- name: Run unit tests and generate coverage report
run: |
set -o pipefail # To propagate exit code from pytest
pytest tests/examples --ignore=tests/examples/01_icetray/
- name: Print available disk space after unit tests
run: df -h
build-macos-examples:
# Runtime on macOS is multiplied with a factor 10 by github. Minimize!
name: Examples - macOS 15
runs-on: macos-15
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
torch_version: ['2.7.0']
hardware: ["cpu"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Show Python version
run: |
python --version
which python
pip --version
- name: Install dependencies
uses: ./.github/actions/install
with:
torch_version: ${{ matrix.torch_version }}
hardware: ${{ matrix.hardware }}
- name: Print packages in pip
run: |
pip show torch
pip show torch-geometric
pip show torch-cluster
pip show torch-sparse
pip show torch-scatter
- name: Run unit tests and generate coverage report
run: |
set -o pipefail # To propagate exit code from pytest
pytest tests/examples --ignore=tests/examples/01_icetray/
docs:
name: Documentation Compilation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install package
uses: ./.github/actions/install
- name: Build documentation
run: |
cd docs
make clean
sphinx-apidoc \
--module-first \
--separate \
--force \
-d 2 \
--templatedir=source/_templates/ \
-o source/api ../src/
sed -i "2s/.*/API/" source/api/graphnet.rst
make html