Skip to content

slight_adjust

slight_adjust #188

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-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