Skip to content

Commit

Permalink
Merge pull request #223 from asogaard/icetray-action
Browse files Browse the repository at this point in the history
Updating build-icetray action
  • Loading branch information
MortenHolmRep authored Jun 23, 2022
2 parents f3a83fc + 4049fae commit 5cacc15
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/actions/install-cpu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: "Whether to install graphnet as editable"
required: true
default: false
user:
description: "Whether to install graphnet as user"
required: true
default: false
extras:
description: "Extras flags for pip installation of graphnet"
required: true
Expand All @@ -16,8 +20,9 @@ runs:
steps:
- name: Infer installation flags
run: |
PIP_FLAGS=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e" || echo " "`
echo "PIP_FLAGS=${PIP_FLAGS}" >> $GITHUB_ENV
PIP_FLAG_EDITABLE=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e " || echo " "`
PIP_FLAG_USER=`[[ ${{ inputs.user }} =~ (T|t)rue ]] && printf "%s\n" "--user " || echo " "`
echo "PIP_FLAGS=${PIP_FLAG_USER}${PIP_FLAG_EDITABLE}" >> $GITHUB_ENV
shell: bash
- name: Install dependencies
run: |
Expand All @@ -26,5 +31,5 @@ runs:
shell: bash
- name: Install package
run: |
pip install ${{ env.PIP_FLAGS }} -r requirements/torch_cpu.txt .${{ inputs.extras }}
pip install -r requirements/torch_cpu.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
shell: bash
51 changes: 44 additions & 7 deletions .github/workflows/build-icetray.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,59 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

check-cobalt-credentials:
runs-on: ubuntu-latest
outputs:
has_credentials: ${{ steps.setvar.outputs.has_credentials }}
steps:
- name: Check secrets
id: setvar
run: |
if [[ "${{ secrets.PUB_WISC_HOST }}" != "" && \
"${{ secrets.PUB_WISC_USERNAME }}" != "" && \
"${{ secrets.PUB_WISC_PASSWORD }}" != "" ]]; \
then
echo "Credentials to access Cobalt found"
echo "::set-output name=has_credentials::true"
else
echo "Credentials to access Cobalt not found"
echo "::set-output name=has_credentials::false"
fi
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 "::set-output name=has_credentials::true"
else
echo "Credentials to access CodeClimate not found"
echo "::set-output name=has_credentials::false"
fi
build-icetray:
needs: [ check-cobalt-credentials, check-codeclimate-credentials ]
if: needs.check-cobalt-credentials.outputs.has_credentials == 'true'
runs-on: ubuntu-latest
container: icecube/icetray:combo-stable
steps:
- uses: actions/checkout@v2
- 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]
- name: Install package
uses: ./.github/actions/install-cpu
with:
editable: true
- name: Check secrets
run: |
echo "PUB_WISC_USERNAME=${{ secrets.PUB_WISC_USERNAME }}" >> $GITHUB_ENV
- name: Retrieve test data
if: "${{ env.PUB_WISC_USERNAME != '' }}"
run: |
# Create test data directory
mkdir -p $TEST_DATA_DIR
Expand All @@ -50,17 +89,15 @@ jobs:
MD5HASH: 80006a6d58338eb8ea153d2b7b02c0a1
shell: bash
- name: Run unit tests and generate coverage report
if: "${{ env.PUB_WISC_USERNAME != '' }}"
run: |
coverage run --source=graphnet -m pytest tests/
coverage xml -o coverage.xml
- name: Work around permission issue
if: "${{ env.PUB_WISC_USERNAME != '' }}"
run: |
git config --global --add safe.directory /__w/graphnet/graphnet
- name: Publish code coverage
uses: paambaati/[email protected]
if: "${{ env.CC_TEST_REPORTER_ID != '' }} && ${{ env.PUB_WISC_USERNAME != '' }}"
if: needs.check-codeclimate-credentials.outputs.has_credentials == 'true'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
with:
Expand Down

0 comments on commit 5cacc15

Please sign in to comment.