forked from statechannels/go-nitro
-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (85 loc) · 4.19 KB
/
testground.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Run Testground
on:
pull_request:
paths: ['**/*.go']
jobs:
run-testground:
runs-on: ubuntu-latest
container: iptestground/testground:edge
steps:
- uses: actions/setup-go@v3
with:
go-version: "^1.19.0"
# Get testground and our test plan code
- uses: actions/checkout@v3
with:
repository: 'statechannels/testground'
path: "code/testground"
- uses: actions/checkout@v3
with:
repository: 'statechannels/go-nitro-testground'
path: "code/go-nitro-testground"
ref: main
# Update our test plan so it uses the version of go-nitro from this workflow
- name: Update Test Dependency
run: go get github.com/statechannels/go-nitro@${{github.event.pull_request.head.sha}}
working-directory: "code/go-nitro-testground"
- name: Import Test
run: testground plan import --from ./go-nitro-testground
working-directory: "code"
# Set the start time for the dashboard time range
- name: Set Start Time
id: set_start_time
# We add 45 seconds to the start time so the dashboard ignores startup when nothing is happening
# We multiply by 1000 to get the timestamp in MS which grafana expects
run: |
echo "::set-output name=START_TIME_OFFSET::$(((`date '+%s'`+45)*1000))"
# Run a short test using the wait flag so we block until it completes
- name: Run Test
run: |
testground --endpoint=${{secrets.TG_SERVER_URL}} run s --wait \
-tp=isCI=true -p=go-nitro-testground -t=virtual-payment \
-b=docker:go -r=local:docker \
-tp=numOfHubs=1 -tp=numOfPayers=2 -tp=numOfPayees=5 -i=8 \
-tp=paymentTestDuration=60 -tp=concurrentPaymentJobs=3 \
--tp=networkLatency=10 --tp=networkJitter=1 \
--metadata-repo "${{github.repository}}" \
--metadata-branch "${{github.event.pull_request.head.ref}}" \
--metadata-commit "${{github.event.pull_request.head.sha}}" | tee run.out
# Parse the run outcome and id from the testground run output
- name: Set Run Outcome
id: set_run_outcome
run: |
echo "::set-output name=RUN_OUTCOME::$(awk '/run finished with outcome/ {print $10}' <run.out)"
- name: Set Run Id
id: set_run_id
run: |
echo "::set-output name=RUN_ID::$(awk '/run is queued with ID/ {print $10}' <run.out)"
# Set the end time for the dashboard time range
- name: Set Done Time
id: set_done_time
run: |
echo "::set-output name=DONE_TIME::$((`date '+%s'`*1000))"
# Look for an existing comment from the bot and update it
- name: Find dashboard links comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Testground Run
- name: Update dashboard links comment
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
# 🧪 Testground Run for ${{github.event.pull_request.head.sha}}
- [Message Stats Dashboard](${{secrets.TG_GRAFANA_URL}}/d/miulKz7Vk/message-stats?orgId=1&var-runId=${{steps.set_run_id.outputs.RUN_ID}}&from=${{steps.set_start_time.outputs.START_TIME_OFFSET}}&to=${{steps.set_done_time.outputs.DONE_TIME}})
- [Time to First Payment Dashboard](${{secrets.TG_GRAFANA_URL}}/d/5OBBeW37k/time-to-first-payment?orgId=1&var-runId=${{steps.set_run_id.outputs.RUN_ID}}&from=${{steps.set_start_time.outputs.START_TIME_OFFSET}}&to=${{steps.set_done_time.outputs.DONE_TIME}})
- [Logs](${{secrets.TG_SERVER_URL}}/logs?task_id=${{steps.set_run_id.outputs.RUN_ID}})
- [Output download](${{secrets.TG_SERVER_URL}}/outputs?run_id=${{steps.set_run_id.outputs.RUN_ID}})
edit-mode: append
- name: Fail if testground run failed
if: ${{ steps.set_run_outcome.outputs.RUN_OUTCOME != 'success' }}
run: exit 1