-
Notifications
You must be signed in to change notification settings - Fork 60
81 lines (69 loc) · 2.54 KB
/
prjob_tests.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
name: Tests
on:
pull_request:
branches:
- "*"
jobs:
test-go:
name: Go
runs-on:
- ubuntu-latest
steps:
- name: Enable docker.host.internal for Ubuntu
run: |
pwd && sudo bash -c 'echo "172.17.0.1 host.docker.internal" >> /etc/hosts'
- uses: actions/checkout@v2
- name: Clone Stack
run: |
git clone --single-branch --branch change_v2_ports https://github.com/stakwork/sphinx-stack.git stackv2;
- name: Run Stack V2
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: |
GITACTION_ENV=gitactionenv docker compose -f ./stackv2/alts/v2.yml --project-directory ./stackv2 up -d;
sleep 240;
docker ps
docker logs alice.sphinx
docker logs bob.sphinx
docker wait stackv2-v2setup-1
- name: Starting DB
run: docker compose -f ./docker/testdb-docker-compose.yml -p test_db up -d
- name: Install cover
run: go get golang.org/x/tools/cmd/cover
- name: Tests
continue-on-error: true
run: |
if ! sudo V2_BOT_URL=http://localhost:3005 V2_BOT_TOKEN=xyzxyzxyz go test ./... -failfast -race -v -coverprofile=coverage.out > test_output.log 2>&1; then
echo "::set-output name=test_status::failed"
fi
./cover-check.sh coverage.out 8.4
- name: Upload test log
if: ${{steps.tests.outputs.test_status}} == 'failed'
uses: actions/upload-artifact@v3
with:
name: test-logs
path: test_output.log
- name: Parse test log
if: ${{steps.tests.outputs.test_status}} == 'failed'
run: |
cat test_output.log
if grep -q "error" test_output.log; then
echo "Errors found in the logs."
# Write a loop here to get all the errors
# Send a curl request to jarvis use the env vars to set the url and token
#curl -X POST \
#-H "Content-Type: application/json" \
#-H "Authorization: Bearer ${{ secrets.JARVIS_API_TOKEN }}" \
#-d '{"log": "<log variable here>"}' \
#${{ secrets.JARVIS_URL }}/endpoint
else
echo "No errors found in the logs."
fi
exit 1
- name: Droping DB with docker compose
run: docker compose -f ./docker/testdb-docker-compose.yml -p test_db down
- name: Stop Stack
working-directory: ./stackv2
run: docker compose down