Skip to content

Commit 4ebb402

Browse files
authored
Merge branch 'graphnet-team:main' into fix_workflow
2 parents 67b234f + c85e413 commit 4ebb402

68 files changed

Lines changed: 1111 additions & 315 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/install/action.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,61 @@ inputs:
1313
extras:
1414
description: "Extras flags for pip installation of graphnet"
1515
required: true
16-
default: "[develop,torch]"
16+
default: "develop"
17+
18+
torch_version:
19+
description: "Version of PyTorch"
20+
required: true
21+
default: "2.6.0"
22+
options: ["2.7.0", "2.6.0", "2.5.0", "2.4.0"]
23+
1724
hardware:
1825
description: "The requirements file depends on the hardware, i.e., CPU, GPU, or macOS"
1926
required: true
2027
default: "cpu"
21-
options: ["cpu", "cu118", "cu121", "macos"]
28+
options: ["cpu", "cu118", "cu121", "cu124", "cu126", "macos"]
29+
30+
use_vm:
31+
description: "Should the installation happen in a virtual environment named venv?"
32+
required: true
33+
default: false
34+
options: [true, false]
2235

2336
runs:
2437
using: "composite"
2538
steps:
26-
- name: Infer installation flags
39+
- name: Prepare pip flags
40+
id: flags
41+
run: |
42+
[[ "${{ inputs.editable }}" == "true" ]] && echo "editable_flag=-e" >> $GITHUB_OUTPUT || echo "editable_flag=" >> $GITHUB_OUTPUT
43+
[[ "${{ inputs.user }}" == "true" ]] && echo "user_flag=--user" >> $GITHUB_OUTPUT || echo "user_flag=" >> $GITHUB_OUTPUT
44+
45+
version="${{ inputs.torch_version }}"
46+
IFS='.' read -r major minor _ <<< "$version"
47+
echo "torch_flag=${major}${minor}" >> $GITHUB_OUTPUT
48+
shell: bash
49+
50+
- name: Install dependencies (pip & setuptools)
51+
shell: bash
2752
run: |
28-
PIP_FLAG_EDITABLE=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e " || echo " "`
29-
PIP_FLAG_USER=`[[ ${{ inputs.user }} =~ (T|t)rue ]] && printf "%s\n" "--user " || echo " "`
30-
echo "PIP_FLAGS=${PIP_FLAG_USER}${PIP_FLAG_EDITABLE}" >> $GITHUB_ENV
53+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
54+
pip install --upgrade 'pip>=20'
55+
pip install --upgrade 'setuptools>=68.2.2'
56+
57+
- name: Print pip and setuptools versions
3158
shell: bash
32-
- name: Install dependencies
3359
run: |
34-
pip install --upgrade pip>=20
35-
pip install wheel setuptools==59.5.0
60+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
61+
pip --version
62+
pip show setuptools
63+
64+
- name: Install GraphNeT
3665
shell: bash
37-
- name: Install package
3866
run: |
39-
echo requirements/torch_${{ inputs.hardware }}.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
40-
pip install -r requirements/torch_${{ inputs.hardware }}.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
67+
if [[ "${{ inputs.use_vm }}" == "true" ]]; then source ~/venv/bin/activate; fi
68+
69+
echo "Installing graphnet with flags: ${{ steps.flags.outputs.user_flag }} ${{ steps.flags.outputs.editable_flag }}"
70+
pip install ${{ steps.flags.outputs.user_flag }} ${{ steps.flags.outputs.editable_flag }} .[torch-${{ steps.flags.outputs.torch_flag }}-${{ inputs.hardware }},${{ inputs.extras }}] \
71+
-f https://data.pyg.org/whl/torch-${{ inputs.torch_version }}+${{ inputs.hardware }}.html
72+
4173
pip install git+https://github.com/thoglu/jammy_flows.git
42-
shell: bash

.github/workflows/build.yml

Lines changed: 116 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,81 +33,141 @@ jobs:
3333
fi
3434
3535
build-icetray:
36-
name: Unit tests - IceTray
36+
name: Unit tests - IceTray (v1.13.0 - 3.10)
3737
needs: [ check-codeclimate-credentials ]
3838
runs-on: ubuntu-22.04
39+
strategy:
40+
matrix:
41+
torch_version: ['2.7.0']
42+
hardware: ["cpu"]
3943
container:
40-
image: icecube/icetray:icetray-prod-v1.8.1-ubuntu20.04-X64
41-
options: --user root
44+
# GitHub Actions overwrite the docker container entrypoint
45+
# inspect <image> --format '{{.Config.Entrypoint}}'
46+
image: icecube/icetray:icetray-devel-v1.13.0-ubuntu22.04-2025-02-12
47+
4248
steps:
43-
- name: install git
49+
- name: Mimmick Docker Entrypoint
50+
# The entrypoint of the container sets python paths
51+
# Because the entrypoint is skipped by GitHub, we set it here
52+
run: |
53+
echo "I3_SRC=/opt/icetray/share/icetray" >> $GITHUB_ENV
54+
echo "I3_BUILD=/opt/icetray/share/icetray" >> $GITHUB_ENV
55+
echo "I3_TESTDATA=/root/icetray/build/test-data" >> $GITHUB_ENV
56+
echo "I3_PRODDATA=/root/icetray/build/prod-data" >> $GITHUB_ENV
57+
echo "ROOTSYS=/opt/icetray/cernroot" >> $GITHUB_ENV
58+
echo "LD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
59+
echo "DYLD_LIBRARY_PATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:/opt/icetray/lib/tools:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
60+
echo "PYTHONPATH=/opt/icetray/lib:/opt/icetray/cernroot/lib:$PYTHONPATH" >> $GITHUB_ENV
61+
echo "PATH=/opt/icetray/bin:$PATH" >> $GITHUB_ENV
62+
echo "HDF5_USE_FILE_LOCKING=FALSE" >> $GITHUB_ENV
63+
- name: Verify IceCube is importable
64+
run: python3 -c "import icecube; print('Import Successful')"
65+
- name: Show python version
66+
run: |
67+
python3 --version
68+
pip --version
69+
pip3 list
70+
python3 -c "import icecube; print(icecube.__path__)"
71+
pip show setuptools
72+
73+
- name: Install git
4474
run: |
4575
apt-get --yes install sudo
4676
sudo apt update --fix-missing --yes
4777
sudo apt upgrade --yes
48-
sudo apt-get install --yes git-all
49-
- name: Set environment variables
78+
sudo apt-get install --yes git
79+
80+
- uses: actions/checkout@v4
81+
82+
- name: Create virtual environment
83+
shell: bash
5084
run: |
51-
echo "PATH=/usr/local/icetray/bin:$PATH" >> $GITHUB_ENV
52-
echo "PYTHONPATH=/usr/local/icetray/lib:$PYTHONPATH" >> $GITHUB_ENV
53-
echo "LD_LIBRARY_PATH=/usr/local/icetray/lib:/usr/local/icetray/cernroot/lib:/usr/local/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
54-
- uses: actions/checkout@v3
85+
python3 -m venv ~/venv --upgrade-deps
86+
source ~/venv/bin/activate
87+
pip --version
88+
python --version
89+
pip show setuptools
90+
5591
- name: Print available disk space before graphnet install
5692
run: df -h
57-
- name: Upgrade packages already installed on icecube/icetray
93+
94+
- name: Upgrade packages in virtual environment
95+
shell: bash
5896
run: |
59-
pip install --upgrade astropy # Installed version incompatible with numpy 1.23.0 [https://github.com/astropy/astropy/issues/12534]
60-
pip install --ignore-installed PyYAML # Distutils installed [https://github.com/pypa/pip/issues/5247]
61-
pip install --upgrade psutil # Original version from IceTray Environment incompatible
97+
source ~/venv/bin/activate
98+
pip install --upgrade astropy
99+
pip install --upgrade PyYAML
100+
pip install --upgrade psutil
101+
pip install --upgrade setuptools
102+
pip install --upgrade versioneer
103+
pip show setuptools
104+
pip show versioneer
62105
- name: Install package
63106
uses: ./.github/actions/install
64107
with:
65108
editable: true
109+
use_vm: true
110+
torch_version: ${{ matrix.torch_version }}
111+
hardware: ${{ matrix.hardware }}
66112
- name: Print packages in pip
113+
shell: bash
67114
run: |
115+
source ~/venv/bin/activate
68116
pip show torch
69117
pip show torch-geometric
70118
pip show torch-cluster
71119
pip show torch-sparse
72120
pip show torch-scatter
73121
pip show jammy_flows
74122
- name: Run unit tests and generate coverage report
123+
shell: bash
75124
run: |
125+
source ~/venv/bin/activate
76126
coverage run --source=graphnet -m pytest tests/ --ignore=tests/examples/04_training --ignore=tests/utilities
77127
coverage run -a --source=graphnet -m pytest tests/examples/04_training
78128
coverage run -a --source=graphnet -m pytest tests/utilities
79129
coverage xml -o coverage.xml
80-
130+
coverage report -m
81131
- name: Work around permission issue
82132
run: |
83133
git config --global --add safe.directory /__w/graphnet/graphnet
84134
- name: Publish code coverage
85-
uses: paambaati/codeclimate-action@v3.0.0
135+
uses: paambaati/codeclimate-action@v9.0.0
86136
if: needs.check-codeclimate-credentials.outputs.has_credentials == 'true'
87137
env:
88138
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
89-
with:
90-
coverageCommand: coverage report
139+
with:
91140
coverageLocations: coverage.xml:coverage.py
141+
92142

93-
build-matrix:
94-
name: Unit tests - Python versions
143+
build-matrix-examples:
144+
name: Examples - Ubuntu 22.04
95145
runs-on: ubuntu-22.04
96146
strategy:
97147
matrix:
98-
python-version: [3.8, 3.9, '3.10', '3.11']
148+
python-version: ['3.11']
149+
torch_version: ['2.7.0', '2.6.0', '2.5.0']
150+
hardware: ["cpu"]
99151
steps:
100-
- uses: actions/checkout@v3
152+
- uses: actions/checkout@v4
101153
- name: Set up Python ${{ matrix.python-version }}
102154
uses: actions/setup-python@v4
103155
with:
104156
python-version: ${{ matrix.python-version }}
105157
- name: Print available disk space before graphnet install
106158
run: df -h
159+
- name: Show existing environment
160+
run: |
161+
echo "PIP_FLAGS=${PIP_FLAGS}"
162+
python --version
163+
pip --version
164+
pip debug --verbose
107165
- name: Install package
108166
uses: ./.github/actions/install
109167
with:
110168
editable: true
169+
torch_version: ${{ matrix.torch_version }}
170+
hardware: ${{ matrix.hardware }}
111171
- name: Print available disk space after graphnet install
112172
run: df -h
113173
- name: Print packages in pip
@@ -117,32 +177,45 @@ jobs:
117177
pip show torch-cluster
118178
pip show torch-sparse
119179
pip show torch-scatter
180+
pip show dill
120181
pip show numpy
121-
122-
123182
- name: Run unit tests and generate coverage report
124183
run: |
125184
set -o pipefail # To propagate exit code from pytest
126-
coverage run --source=graphnet -m pytest tests/ --ignore=tests/utilities --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/01_icetray/
127-
coverage run -a --source=graphnet -m pytest tests/utilities
128-
coverage report -m
185+
pytest tests/examples --ignore=tests/examples/01_icetray/
129186
- name: Print available disk space after unit tests
130187
run: df -h
131188

132-
build-macos:
133-
name: Unit tests - macOS
134-
runs-on: macos-13
189+
build-macos-examples:
190+
# Runtime on macOS is multiplied with a factor 10 by github. Minimize!
191+
name: Examples - macOS 15
192+
runs-on: macos-15
193+
strategy:
194+
fail-fast: false
195+
matrix:
196+
python-version: ['3.11']
197+
torch_version: ['2.7.0']
198+
hardware: ["cpu"]
199+
135200
steps:
136-
- uses: actions/checkout@v3
137-
- name: Set up Python 3.8
138-
uses: actions/setup-python@v4
201+
- uses: actions/checkout@v4
202+
203+
- name: Set up Python ${{ matrix.python-version }}
204+
uses: actions/setup-python@v5
139205
with:
140-
python-version: 3.8
141-
- name: Install package
206+
python-version: ${{ matrix.python-version }}
207+
208+
- name: Show Python version
209+
run: |
210+
python --version
211+
which python
212+
pip --version
213+
214+
- name: Install dependencies
142215
uses: ./.github/actions/install
143216
with:
144-
editable: true
145-
hardware: "cpu"
217+
torch_version: ${{ matrix.torch_version }}
218+
hardware: ${{ matrix.hardware }}
146219
- name: Print packages in pip
147220
run: |
148221
pip show torch
@@ -153,15 +226,17 @@ jobs:
153226
- name: Run unit tests and generate coverage report
154227
run: |
155228
set -o pipefail # To propagate exit code from pytest
156-
coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/ --ignore=tests/utilities
157-
coverage run -a --source=graphnet -m pytest tests/utilities
158-
coverage report -m
229+
pytest tests/examples --ignore=tests/examples/01_icetray/
159230
160231
docs:
161232
name: Documentation Compilation
162233
runs-on: ubuntu-22.04
163234
steps:
164-
- uses: actions/checkout@v3
235+
- uses: actions/checkout@v4
236+
- name: Set up Python 3.10
237+
uses: actions/setup-python@v3
238+
with:
239+
python-version: "3.10"
165240
- name: Install package
166241
uses: ./.github/actions/install
167242
- name: Build documentation

.github/workflows/code-quality.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ jobs:
2222
matrix:
2323
hook: ["black", "flake8", "docformatter", "pydocstyle", "mypy"]
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
26+
- name: Set up Python 3.10
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: "3.10"
2630
- name: Install package
2731
uses: ./.github/actions/install
32+
with:
33+
2834
- name: Run ${{ matrix.hook }}
2935
run: |
36+
pip show ${{ matrix.hook }}
3037
pre-commit run ${{ matrix.hook }} --all-files

.github/workflows/docs.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ jobs:
1616
name: Build and publish Documentation
1717
runs-on: ubuntu-22.04
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
2023
- name: Install package
2124
uses: ./.github/actions/install
25+
with:
26+
editable: true
27+
use_vm: false
28+
torch_version: "2.6.0"
29+
hardware: "cpu"
2230
- name: Build documentation
2331
run: |
2432
cd docs

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: flake8
1313
language_version: python3
1414
- repo: https://github.com/pycqa/docformatter
15-
rev: v1.7.5
15+
rev: v1.7.7
1616
hooks:
1717
- id: docformatter
1818
language_version: python3

docs/source/installation/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Installation
44
============
55

6-
|graphnet|\ GraphNeT is available for Python 3.8 to Python 3.11.
6+
|graphnet|\ GraphNeT is available for Python 3.9 to Python 3.11.
77

88
.. note::
99
We recommend installing |graphnet|\ GraphNeT in a separate environment, e.g. using a Python virtual environment or Anaconda (see details on installation `here <https://www.anaconda.com/products/individual>`_).

0 commit comments

Comments
 (0)