Skip to content

Commit 5cacc15

Browse files
Merge pull request #223 from asogaard/icetray-action
Updating build-icetray action
2 parents f3a83fc + 4049fae commit 5cacc15

2 files changed

Lines changed: 52 additions & 10 deletions

File tree

.github/actions/install-cpu/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ inputs:
66
description: "Whether to install graphnet as editable"
77
required: true
88
default: false
9+
user:
10+
description: "Whether to install graphnet as user"
11+
required: true
12+
default: false
913
extras:
1014
description: "Extras flags for pip installation of graphnet"
1115
required: true
@@ -16,8 +20,9 @@ runs:
1620
steps:
1721
- name: Infer installation flags
1822
run: |
19-
PIP_FLAGS=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e" || echo " "`
20-
echo "PIP_FLAGS=${PIP_FLAGS}" >> $GITHUB_ENV
23+
PIP_FLAG_EDITABLE=`[[ ${{ inputs.editable }} =~ (T|t)rue ]] && printf "%s\n" "-e " || echo " "`
24+
PIP_FLAG_USER=`[[ ${{ inputs.user }} =~ (T|t)rue ]] && printf "%s\n" "--user " || echo " "`
25+
echo "PIP_FLAGS=${PIP_FLAG_USER}${PIP_FLAG_EDITABLE}" >> $GITHUB_ENV
2126
shell: bash
2227
- name: Install dependencies
2328
run: |
@@ -26,5 +31,5 @@ runs:
2631
shell: bash
2732
- name: Install package
2833
run: |
29-
pip install ${{ env.PIP_FLAGS }} -r requirements/torch_cpu.txt .${{ inputs.extras }}
34+
pip install -r requirements/torch_cpu.txt ${{ env.PIP_FLAGS }} .${{ inputs.extras }}
3035
shell: bash

.github/workflows/build-icetray.yml

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,59 @@ on:
1313

1414
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1515
jobs:
16+
17+
check-cobalt-credentials:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
has_credentials: ${{ steps.setvar.outputs.has_credentials }}
21+
steps:
22+
- name: Check secrets
23+
id: setvar
24+
run: |
25+
if [[ "${{ secrets.PUB_WISC_HOST }}" != "" && \
26+
"${{ secrets.PUB_WISC_USERNAME }}" != "" && \
27+
"${{ secrets.PUB_WISC_PASSWORD }}" != "" ]]; \
28+
then
29+
echo "Credentials to access Cobalt found"
30+
echo "::set-output name=has_credentials::true"
31+
else
32+
echo "Credentials to access Cobalt not found"
33+
echo "::set-output name=has_credentials::false"
34+
fi
35+
36+
check-codeclimate-credentials:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
has_credentials: ${{ steps.setvar.outputs.has_credentials }}
40+
steps:
41+
- name: Check secrets
42+
id: setvar
43+
run: |
44+
if [[ "${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}" != "" ]]; \
45+
then
46+
echo "Credentials to access CodeClimate found"
47+
echo "::set-output name=has_credentials::true"
48+
else
49+
echo "Credentials to access CodeClimate not found"
50+
echo "::set-output name=has_credentials::false"
51+
fi
52+
1653
build-icetray:
54+
needs: [ check-cobalt-credentials, check-codeclimate-credentials ]
55+
if: needs.check-cobalt-credentials.outputs.has_credentials == 'true'
1756
runs-on: ubuntu-latest
1857
container: icecube/icetray:combo-stable
1958
steps:
2059
- uses: actions/checkout@v2
60+
- name: Upgrade packages already installed on icecube/icetray
61+
run: |
62+
pip install --upgrade astropy # Installed version incompatible with numpy 1.23.0 [https://github.com/astropy/astropy/issues/12534]
63+
pip install --ignore-installed PyYAML # Distutils installed [https://github.com/pypa/pip/issues/5247]
2164
- name: Install package
2265
uses: ./.github/actions/install-cpu
2366
with:
2467
editable: true
25-
- name: Check secrets
26-
run: |
27-
echo "PUB_WISC_USERNAME=${{ secrets.PUB_WISC_USERNAME }}" >> $GITHUB_ENV
2868
- name: Retrieve test data
29-
if: "${{ env.PUB_WISC_USERNAME != '' }}"
3069
run: |
3170
# Create test data directory
3271
mkdir -p $TEST_DATA_DIR
@@ -50,17 +89,15 @@ jobs:
5089
MD5HASH: 80006a6d58338eb8ea153d2b7b02c0a1
5190
shell: bash
5291
- name: Run unit tests and generate coverage report
53-
if: "${{ env.PUB_WISC_USERNAME != '' }}"
5492
run: |
5593
coverage run --source=graphnet -m pytest tests/
5694
coverage xml -o coverage.xml
5795
- name: Work around permission issue
58-
if: "${{ env.PUB_WISC_USERNAME != '' }}"
5996
run: |
6097
git config --global --add safe.directory /__w/graphnet/graphnet
6198
- name: Publish code coverage
6299
uses: paambaati/codeclimate-action@v3.0.0
63-
if: "${{ env.CC_TEST_REPORTER_ID != '' }} && ${{ env.PUB_WISC_USERNAME != '' }}"
100+
if: needs.check-codeclimate-credentials.outputs.has_credentials == 'true'
64101
env:
65102
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
66103
with:

0 commit comments

Comments
 (0)