-
Notifications
You must be signed in to change notification settings - Fork 15
153 lines (135 loc) · 4.87 KB
/
integration_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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Integration Tests
on:
workflow_call:
inputs:
context:
required: true
type: string
secrets:
signalwire_token:
required: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
PGHOST: localhost
PGUSER: postgres
CI: true
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
# Login to AWS to avoid rate limit
- name: Configure AWS credentials
id: aws-login
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-skip-session-tagging: true
role-duration-seconds: 3600
aws-region: ap-southeast-1
- name: Login to AWS Public ECR
uses: docker/login-action@v3
with:
registry: public.ecr.aws
env:
AWS_REGION: us-east-1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Switch App
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/app
tags: switch-app:latest
cache-from: type=gha,scope=integration-tests-switch-app
cache-to: type=gha,mode=max,scope=integration-tests-switch-app
- name: Build FreeSWITCH
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/freeswitch
build-args:
signalwire_token=${{ secrets.signalwire_token }}
tags: freeswitch:latest
cache-from: type=gha,scope=integration-tests-freeswitch
cache-to: type=gha,mode=max,scope=integration-tests-freeswitch
- name: Build FreeSWITCH Event Logger
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/freeswitch_event_logger
tags: freeswitch_event_logger:latest
cache-from: type=gha,scope=integration-tests-freeswitch-event-logger
cache-to: type=gha,mode=max,scope=integration-tests-freeswitch-event-logger
- name: Build Public Gateway
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/gateway
target: public_gateway
tags: public_gateway:latest
cache-from: type=gha,scope=integration-tests-public-gateway
cache-to: type=gha,mode=max,scope=integration-tests-public-gateway
- name: Build Client Gateway
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/gateway
target: client_gateway
tags: client_gateway:latest
cache-from: type=gha,scope=integration-tests-client-gateway
cache-to: type=gha,mode=max,scope=integration-tests-client-gateway
- name: Build Media Proxy
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/media_proxy
tags: media_proxy:latest
cache-from: type=gha,scope=integration-tests-media-proxy
cache-to: type=gha,mode=max,scope=integration-tests-media-proxy
- name: Build Gateway Bootstrap
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/gateway
target: bootstrap
tags: gateway:bootstrap
cache-from: type=gha,scope=integration-tests-gateway-bootstrap
cache-to: type=gha,mode=max,scope=integration-tests-gateway-bootstrap
- name: Build Testing
uses: docker/build-push-action@v6
with:
push: false
load: true
context: components/testing
tags: testing:latest
cache-from: type=gha,scope=integration-tests-testing
cache-to: type=gha,mode=max,scope=integration-tests-testing
- name: Run docker compose
run: |
docker compose run -e DATABASE_NAME=opensips_${{ inputs.context }}_test gateway-bootstrap create_db ${{ inputs.context }}
docker compose up --wait -d ${{ inputs.context }} media_proxy freeswitch freeswitch_event_logger switch-app redis testing
- name: Run ${{ inputs.context }} Tests
run: |
docker compose exec testing ./tests.sh ./tests/${{ inputs.context }}