-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (107 loc) · 6.53 KB
/
e2e.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: E2E Tests
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- run: |
PROBE_VERSION="$(python setup.py --version)"
echo "SPP_PROBE_VERSION=$PROBE_VERSION" >> $GITHUB_ENV
- run: ./gradlew assembleUp
- name: Docker IPs
run: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
- name: Set E2E_APP_HOST
run: E2E_APP_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=e2e-test")) && echo "E2E_APP_HOST=$E2E_APP_HOST" >> $GITHUB_ENV
- name: Set SPP_PLATFORM_HOST
run: SPP_PLATFORM_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=spp-platform")) && echo "SPP_PLATFORM_HOST=$SPP_PLATFORM_HOST" >> $GITHUB_ENV
- name: Set SPP_JWT_TOKEN
run: until $(curl --output /dev/null --silent --fail http://localhost:12800/api/new-token?authorization_code=change-me); do printf '.'; sleep 5; done && SPP_JWT_TOKEN=$(curl http://localhost:12800/api/new-token?authorization_code=change-me) && echo "SPP_JWT_TOKEN=$SPP_JWT_TOKEN" >> $GITHUB_ENV
- name: Wait for platform
run: |
until $(curl --header "Authorization: Bearer ${{ env.SPP_JWT_TOKEN }}" --output /dev/null --silent --fail http://localhost:12800/health); do printf '.'; sleep 5; done
- run: curl -sS https://webinstall.dev/jq | bash
- run: sleep 45s #wait for services to connect; todo: use health endpoint
- name: Verify probe connected
run: |
resp=$(curl --header "Authorization: Bearer ${{ env.SPP_JWT_TOKEN }}" http://localhost:12800/clients) && [[ $(echo $resp | jq -r ."probes"[0]."meta"."language") == "python" ]] && echo $resp || (echo $resp && exit 1)
- name: Download & install spp-cli
run: |
curl -O -J -L https://github.com/sourceplusplus/interface-cli/releases/download/0.7.5/spp-cli-0.7.5-linux64.zip && unzip spp-cli-0.7.5-linux64.zip && chmod +x spp-cli && mv spp-cli /usr/local/bin/spp-cli
- name: Live breakpoint (false condition)
run: |
spp-cli -a change-me add breakpoint -c 1==2 E2ETest.py 19
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."applied") == "true" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "0" ]] && echo $resp || (echo $resp && exit 1)
spp-cli -a change-me remove all-instruments
- name: Live log (false condition)
run: |
spp-cli -a change-me add log -c 1==2 -l provider E2ETest.py 19 Hello {}
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."applied") == "true" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "0" ]] && echo $resp || (echo $resp && exit 1)
spp-cli -a change-me remove all-instruments
- name: Live breakpoint (hit limit = 2)
run: |
spp-cli -a change-me add breakpoint -hitLimit 2 E2ETest.py 19
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."applied") == "true" ]] && echo $resp || (echo $resp && exit 1)
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."hitLimit") == "2" ]] && echo $resp || (echo $resp && exit 1)
#resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "0" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
#resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "1" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
resp=$(spp-cli -a change-me get instruments) && [[ $resp == "[ ]" ]] && echo $resp || (echo $resp && exit 1)
- name: Live log (hit limit = 2)
run: |
spp-cli -a change-me add log -hitLimit 2 -l provider E2ETest.py 19 Hello {}
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."applied") == "true" ]] && echo $resp || (echo $resp && exit 1)
resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."hitLimit") == "2" ]] && echo $resp || (echo $resp && exit 1)
#resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "0" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
#resp=$(spp-cli -a change-me get instruments) && [[ $(echo $resp | jq -r .[0]."meta"."hit_count") == "1" ]] && echo $resp || (echo $resp && exit 1)
curl ${{ env.E2E_APP_HOST }}:5000 && sleep 35s
resp=$(spp-cli -a change-me get instruments) && [[ $resp == "[ ]" ]] && echo $resp || (echo $resp && exit 1)
- run: ./gradlew composeLogs
if: ${{ !cancelled() }}
- name: Upload docker logs artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: docker-logs
path: ./build/containers-logs
- name: Remove Old Release Drafts
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
- name: Create Release Draft
if: github.ref == 'refs/heads/master'
id: createDraft
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.SPP_PROBE_VERSION }}
release_name: v${{ env.SPP_PROBE_VERSION }}
draft: true