-
Notifications
You must be signed in to change notification settings - Fork 8
63 lines (58 loc) · 1.79 KB
/
go.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
name: Go CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- '.github/workflows/go.yml'
- 'go-example/**'
jobs:
build_and_run_go_app:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.19.x, 1.20.x ]
name: Go ${{ matrix.go-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Download dependencies(manual-instrumentation)
working-directory: ./go-example/manual-instrumentation
run: |
go mod tidy
- name: Run application(manual-instrumentation)
working-directory: ./go-example/manual-instrumentation
run: |
go run main.go
- name: Download dependencies(auto-instrumentation)
working-directory: ./go-example/auto-instrumentation
run: |
go mod tidy
- name: Run application(auto-instrumentation)
working-directory: ./go-example/auto-instrumentation
run: |
set -x
go build -o ./auto-instrumentation
./auto-instrumentation &
TEMP_OUTPUT_FILE=$(mktemp)
WAIT_TIME=5
for i in `seq 1 3`;
do
set +e
HTTP_CODE=$(curl --silent --output $TEMP_OUTPUT_FILE --write-out "%{http_code}" "http://localhost:8080")
set -e
if [[ ${HTTP_CODE} -lt 200 || ${HTTP_CODE} -gt 299 ]] ; then
>&2 cat $TEMP_OUTPUT_FILE
WAIT_TIME=$((WAIT_TIME * $i));
echo Sleeping for ${WAIT_TIME} seconds...
sleep ${WAIT_TIME}
else
cat $TEMP_OUTPUT_FILE
rm $TEMP_OUTPUT_FILE
break
fi
done