-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 2.54 KB
/
planner_integration.yaml
File metadata and controls
95 lines (82 loc) · 2.54 KB
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
name: Planner Go App Integration Tests
on:
pull_request:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
planner: ${{ steps.filter.outputs.planner }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
planner:
- 'cmd/planner/**'
- 'internal/planner/**'
- '.github/workflows/planner_integration.yaml'
integration-test:
needs: detect-changes
if: needs.detect-changes.outputs.planner == 'true'
runs-on: [self-hosted-linux-amd64-noble-edge]
name: Run Go Integration Tests
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.26
- name: Wait for rabbitmq
run: |
until curl -fs http://localhost:15672;
do echo "waiting for rabbit mq"
sleep 2
done
- name: Build and Test
env:
POSTGRESQL_DB_CONNECT_STRING: postgres://postgres:postgres@localhost:5432/postgres
APP_PORT: 8080
RABBITMQ_CONNECT_STRING: amqp://guest:guest@localhost:5672/
run: |
go test -v -cover -tags=integration -race ./cmd/planner/...
services:
postgres:
image: postgres:16.13
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:4-management
ports:
- 5672:5672
- 15672:15672
planner-integration-status-check:
runs-on: ubuntu-latest
needs: [detect-changes, integration-test]
if: always()
steps:
- name: Check integration test results
run: |
# If tests were skipped because no changes, that's success
if [ "${{ needs.detect-changes.outputs.planner }}" != "true" ]; then
echo "No planner changes detected, skipping tests is expected"
exit 0
fi
# If tests ran, check their results
integration_result="${{ needs.integration-test.result }}"
echo "Integration test result: $integration_result"
# Fail if test that ran actually failed (not skipped)
if [ "$integration_result" = "failure" ]; then
echo "Integration test failed"
exit 1
fi
echo "Integration test passed or was skipped appropriately"
exit 0