forked from graphnet-team/graphnet
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (168 loc) · 6.31 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# 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-latest
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
needs: [ check-codeclimate-credentials ]
runs-on: ubuntu-latest
container:
image: icecube/icetray:icetray-prod-v1.8.1-ubuntu20.04-X64
options: --user root
steps:
- 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-all
- name: Set environment variables
run: |
echo "PATH=/usr/local/icetray/bin:$PATH" >> $GITHUB_ENV
echo "PYTHONPATH=/usr/local/icetray/lib:$PYTHONPATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/local/icetray/lib:/usr/local/icetray/cernroot/lib:/usr/local/icetray/lib/tools:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Print available disk space before graphnet install
run: df -h
- name: Upgrade packages already installed on icecube/icetray
run: |
pip install --upgrade astropy # Installed version incompatible with numpy 1.23.0 [https://github.com/astropy/astropy/issues/12534]
pip install --ignore-installed PyYAML # Distutils installed [https://github.com/pypa/pip/issues/5247]
pip install --upgrade psutil # Original version from IceTray Environment incompatible
- name: Install package
uses: ./.github/actions/install
with:
editable: true
- 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 jammy_flows
- name: Run unit tests and generate coverage report
run: |
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
- name: Work around permission issue
run: |
git config --global --add safe.directory /__w/graphnet/graphnet
- name: Publish code coverage
uses: paambaati/[email protected]
if: needs.check-codeclimate-credentials.outputs.has_credentials == 'true'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
with:
coverageCommand: coverage report
coverageLocations: coverage.xml:coverage.py
build-matrix:
name: Unit tests - Python versions
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- 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: Install package
uses: ./.github/actions/install
with:
editable: true
- 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 numpy
- name: Run unit tests and generate coverage report
run: |
set -o pipefail # To propagate exit code from pytest
coverage run --source=graphnet -m pytest tests/ --ignore=tests/utilities --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/01_icetray/
coverage run -a --source=graphnet -m pytest tests/utilities
coverage report -m
- name: Print available disk space after unit tests
run: df -h
build-macos:
name: Unit tests - macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install package
uses: ./.github/actions/install
with:
editable: true
hardware: "cpu"
- 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
coverage run --source=graphnet -m pytest tests/ --ignore=tests/data/ --ignore=tests/deployment/ --ignore=tests/examples/ --ignore=tests/utilities
coverage run -a --source=graphnet -m pytest tests/utilities
coverage report -m
docs:
name: Documentation Compilation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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