-
Notifications
You must be signed in to change notification settings - Fork 118
70 lines (64 loc) · 2.73 KB
/
external.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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 }}