Skip to content

Commit

Permalink
Convert BS_UID to string and general cleanup of scoring pipeline (#510
Browse files Browse the repository at this point in the history
)

* cast BS_UID to string

* only treat PLUGIN_INFO as JSON (not string)

* cleanup

* typo

* Clarify check if scoring needed job name

* curly brackets around needs & steps

---------

Co-authored-by: Katherine Fairchild <[email protected]>
  • Loading branch information
kvfairchild and Katherine Fairchild authored Jan 12, 2024
1 parent a513481 commit 8fe2ab7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/score_new_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,30 @@ jobs:
- name: Get plugin info
id: getpluginfo
run: |
echo "PLUGIN_INFO='$(python -c 'from brainscore_core.plugin_management.parse_plugin_changes import get_scoring_info; get_scoring_info("${{ env.CHANGED_FILES }}", "brainscore_vision")')'" >> $GITHUB_OUTPUT
echo "PLUGIN_INFO='$(python -c 'from brainscore_core.plugin_management.parse_plugin_changes import get_scoring_info; get_scoring_info("${{ env.CHANGED_FILES }}", "brainscore_vision")')'" >> $GITHUB_OUTPUT
- name: Check if scoring needed
id: scoringneeded
run: |
echo "RUN_SCORING=$(jq -r '.run_score' <<< ${{ steps.getpluginfo.outputs.PLUGIN_INFO }})" >> $GITHUB_OUTPUT
get_submitter_info:
name: Get PR author email and (if web submission) Brain-Score user ID
runs-on: ubuntu-latest
needs: [changes_models_or_benchmarks]
if: needs.changes_models_or_benchmarks.outputs.RUN_SCORING == 'True'
env:
PLUGIN_INFO: $(<<< ${{ needs.changes_models_or_benchmarks.outputs.PLUGIN_INFO }} tr -d "'") # str -> JSON
PLUGIN_INFO: ${{ needs.changes_models_or_benchmarks.outputs.PLUGIN_INFO }}
outputs:
PLUGIN_INFO: steps.add_email_to_pluginfo.outputs.PLUGIN_INFO
PLUGIN_INFO: ${{ steps.add_email_to_pluginfo.outputs.PLUGIN_INFO }}
steps:
- name: Parse user ID from PR title and add to PLUGIN_INFO (WEB ONLY where we don't have access to the GitHub user)
id: add_uid_to_pluginfo
if: contains(github.event.pull_request.labels.*.name, 'automerge-web')
run: |
BS_UID="$(echo '${{ github.event.pull_request.title }}' | sed -E 's/.*\(user:([^)]+)\).*/\1/')"
echo "The Brain-Score user ID is $BS_UID"
printf "PLUGIN_INFO=$(<<<$PLUGIN_INFO jq ". + {user_id: \"$BS_UID\"}")" >> $GITHUB_ENV
echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c ". + {user_id: \"$BS_UID\"}")" >> $GITHUB_ENV
- name: Get PR author email from GitHub username
id: getemail
Expand All @@ -88,7 +87,7 @@ jobs:
id: add_email_to_pluginfo
run: |
echo "The PR author email is ${{ steps.getemail.outputs.email }}"
printf "PLUGIN_INFO=$(<<<$PLUGIN_INFO jq ". + {author_email: \"${{ steps.getemail.outputs.email }}\"}")" >> $GITHUB_OUTPUT
echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c '. + {author_email: "${{ steps.getemail.outputs.email }}"}')" >> $GITHUB_OUTPUT
run_scoring:
name: Score plugins
Expand All @@ -103,7 +102,7 @@ jobs:
steps:
- name: Add domain, public, competition, and model_type to PLUGIN_INFO
run: |
echo "PLUGIN_INFO=$(echo "$PLUGIN_INFO" | jq -c '. + {domain: "vision", public: true, competition: "None", model_type: "Brain_Model"}')" >> $GITHUB_ENV
echo "PLUGIN_INFO=$(<<<$PLUGIN_INFO tr -d "'" | jq -c '. + {domain: "vision", public: true, competition: "None", model_type: "Brain_Model"}')" >> $GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -116,8 +115,8 @@ jobs:
- name: Build project
run: |
python -m pip install --upgrade pip setuptools
python -m pip install ".[test]"
python -m pip install "."
- name: Run scoring
run: |
python -c "from brainscore_core.submission.endpoints import call_jenkins; call_jenkins('\''${{ env.PLUGIN_INFO }}'\'')"
python -c 'from brainscore_core.submission.endpoints import call_jenkins; call_jenkins('\''${{ env.PLUGIN_INFO }}'\'')'

0 comments on commit 8fe2ab7

Please sign in to comment.