Skip to content

Move random to src/gnu #142

Move random to src/gnu

Move random to src/gnu #142

Workflow file for this run

name: External CIs
concurrency:
group: ${{ github.workflow }}#${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [ labeled ]
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
get-last-azure-url:
runs-on: ubuntu-latest
if: ${{ github.event.label.name == 'nrn-modeldb-ci-nightly' }}
outputs:
azure_drop_url: ${{ steps.drop.outputs.azure_drop_url }}
pr_azure_sha: ${{ steps.drop.outputs.pr_azure_sha }}
steps:
- id: drop
run: |
# use jq to get the last Azure drop URL from the PR and the SHA1 from the same body
export pr_json=$(gh pr view $PR_URL --json comments -q 'last(.comments[] .body | capture(".*(?<pr_azure_sha>[0-9a-f]{40}).*?(?<azure_drop_url>https://dev.azure.com/neuronsimulator/.*=zip)"))')
if [ -z "$pr_json" ]; then
echo "Unable to retrieve AZURE drop url and SHA from comments!"
exit 1
fi
# use jq to get pr_azure_sha and azure_drop_url from the json
export azure_drop_url=$(echo $pr_json | jq -r .azure_drop_url)
export pr_azure_sha=$(echo $pr_json | jq -r .pr_azure_sha)
echo azure_drop_url=$azure_drop_url >> $GITHUB_OUTPUT
echo pr_azure_sha=$pr_azure_sha >> $GITHUB_OUTPUT
- id: remove-label
if: always()
run: |
# remove the label
gh pr edit $PR_URL --remove-label nrn-modeldb-ci-nightly
# if we encounter an error in last github action step, add a comment
if [ ${{ steps.drop.outcome }} == 'failure' ]; then
gh pr comment $PR_URL --body "Unable to retrieve AZURE drop url from comments!"
else
gh pr comment $PR_URL --body "NEURON ModelDB CI: launching for ${pr_azure_sha} via its [drop url]($azure_drop_url)"
fi
env:
pr_azure_sha: ${{ steps.drop.outputs.pr_azure_sha }}
azure_drop_url: ${{ steps.drop.outputs.azure_drop_url }}
nrn-modeldb-ci:
needs: get-last-azure-url
uses: neuronsimulator/nrn-modeldb-ci/.github/workflows/nrn-modeldb-ci.yaml@master
with:
neuron_v1: ${{needs.get-last-azure-url.outputs.azure_drop_url}}
neuron_v2: neuron-nightly
pr-update:
needs:
- nrn-modeldb-ci
- get-last-azure-url
runs-on: ubuntu-latest
steps:
- run: |
gh pr comment $PR_URL --body "NEURON ModelDB CI: ${pr_azure_sha} -> download reports [from here](${ARTIFACTS_URL})"
name: Post NEURON ModelDB CI Artifact URL
if: always() || cancelled()
env:
ARTIFACTS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
pr_azure_sha: ${{ needs.get-last-azure-url.outputs.pr_azure_sha }}