Fix warnonce #945
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: icecube/icetray:combo-stable | |
steps: | |
- 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: 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: Run unit tests and generate coverage report | |
run: | | |
coverage run --source=graphnet -m pytest tests/ | |
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: Install package | |
uses: ./.github/actions/install | |
with: | |
editable: true | |
- 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/ | |
coverage report -m | |
build-macos: | |
name: Unit tests - macOS | |
runs-on: macos-latest | |
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: "macos" | |
- 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/ | |
coverage report -m |