-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (143 loc) · 6.75 KB
/
ci.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Tests
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.1
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_USER: ${{ secrets.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
POSTGRES_DB: ${{ secrets.DB_DATABASE }}
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
env:
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_HOST_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
ports:
# Maps port 6379 on service container to the host
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Setup Go
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.21' # The Go version to download (if necessary) and use.
# Integration Tests
- name: Integration Tests
# Create a test.env file for running tests
run: |
echo ${{ secrets.FIREBASE_MESSAGING_CONFIG }} > ${{ secrets.FIREBASE_MESSAGING_CONFIG_PATH }}
cat <<EOT >> test.env
CI=${CI}
SECRETS_PROVIDER=${SECRETS_PROVIDER}
AWS_SECRET_NAME=${AWS_SECRET_NAME}
APP_NAME=App
DB_HOST=${DB_HOST}
DB_PORT=${DB_PORT}
DB_DATABASE=${DB_DATABASE}
DB_USER=${DB_USER}
DB_PASSWORD=${DB_PASSWORD}
DB_HOSTS=${DB_HOSTS}
MAILGUN_DOMAIN=${MAILGUN_DOMAIN}
MAILGUN_HOST=${MAILGUN_HOST}
MAILGUN_API_KEY=${MAILGUN_HOST}
REDIS_HOST=${REDIS_HOST}
REDIS_PORT=${REDIS_PORT}
REDIS_PASSWORD=${REDIS_PASSWORD}
REDIS_DATABASE=2
AWS_REGION=${AWS_REGION}
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
AWS_STORAGE_BUCKET=${AWS_STORAGE_BUCKET}
CLICKSEND_USERNAME=${CLICKSEND_USERNAME}
CLICKSEND_API_KEY=${CLICKSEND_API_KEY}
SMSBROADCAST_USERNAME=${SMSBROADCAST_USERNAME}
SMSBROADCAST_PASSWORD=${SMSBROADCAST_PASSWORD}
FIREBASE_DEEPLINK_API_KEY=${FIREBASE_API_KEY}
FIREBASE_DEEPLINK_SHORT_LINKS_URL=${FIREBASE_DEEPLINK_SHORT_LINKS_URL}
FIREBASE_DEEPLINK_DYNAMIC_LINK_DOMAIN=${FIREBASE_DEEPLINK_DYNAMIC_LINK_DOMAIN}
FIREBASE_DEEPLINK_ANDROID_PACKAGE_NAME=${FIREBASE_DEEPLINK_ANDROID_PACKAGE_NAME}
FIREBASE_DEEPLINK_IOS_BUNDLE_ID=${FIREBASE_DEEPLINK_IOS_BUNDLE_ID}
FIREBASE_DEEPLINK_IOS_STORE_ID=${FIREBASE_DEEPLINK_IOS_STORE_ID}
FIREBASE_DEEPLINK_SOCIAL_TITLE=${FIREBASE_DEEPLINK_SOCIAL_TITLE}
FIREBASE_DEEPLINK_SOCIAL_DESCRIPTION=${FIREBASE_DEEPLINK_SOCIAL_DESCRIPTION}
FIREBASE_DEEPLINK_SOCIAL_IMAGE_URL=${FIREBASE_DEEPLINK_SOCIAL_IMAGE_URL}
STRIPE_TOKEN=${STRIPE_TOKEN}
KUTT_API_URL=${KUTT_API_URL}
KUTT_API_KEY=${KUTT_API_KEY}
SMALLR_LINKS_API_URL=${SMALLR_LINKS_API_URL}
SMALLR_LINKS_API_KEY=${SMALLR_LINKS_API_KEY}
NOTIFICATIONS_DISABLED=${NOTIFICATIONS_DISABLED}
FIREBASE_MESSAGING_CONFIG_PATH=${FIREBASE_MESSAGING_CONFIG_PATH}
ONESIGNAL_APP_ID=${ONESIGNAL_APP_ID}
ONESIGNAL_APP_KEY=${ONESIGNAL_APP_KEY}
EOT
go test -v `go list ./...` -coverprofile=coverage.out -covermode=atomic
env:
CI: true
SECRETS_PROVIDER: $${{ secrets.SECRETS_PROVIDER }}
AWS_SECRET_NAME: $${{ secrets.AWS_SECRET_NAME }}
CGO_ENABLED: 0
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_DATABASE: ${{ secrets.DB_DATABASE }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOSTS: ${{ secrets.DB_HOSTS }}
MAILGUN_DOMAIN: ${{ secrets.MAILGUN_DOMAIN }}
MAILGUN_HOST: ${{ secrets.MAILGUN_HOST }}
MAILGUN_API_KEY: ${{ secrets.MAILGUN_API_KEY }}
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
REDIS_DATABASE: ${{ secrets.REDIS_DATABASE }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_STORAGE_BUCKET: ${{ secrets.AWS_STORAGE_BUCKET }}
CLICKSEND_USERNAME: ${{ secrets.CLICKSEND_USERNAME }}
CLICKSEND_API_KEY: ${{ secrets.CLICKSEND_API_KEY }}
SMSBROADCAST_USERNAME: ${{ secrets.SMSBROADCAST_USERNAME }}
SMSBROADCAST_PASSWORD: ${{ secrets.SMSBROADCAST_PASSWORD }}
FIREBASE_DEEPLINK_API_KEY: ${{ secrets.FIREBASE_DEEPLINK_API_KEY }}
FIREBASE_DEEPLINK_SHORT_LINKS_URL: ${{ secrets.FIREBASE_DEEPLINK_SHORT_LINKS_URL }}
FIREBASE_DEEPLINK_DYNAMIC_LINK_DOMAIN: ${{ secrets.FIREBASE_DEEPLINK_DYNAMIC_LINK_DOMAIN }}
FIREBASE_DEEPLINK_ANDROID_PACKAGE_NAME: ${{ secrets.FIREBASE_DEEPLINK_ANDROID_PACKAGE_NAME }}
FIREBASE_DEEPLINK_IOS_BUNDLE_ID: ${{ secrets.FIREBASE_DEEPLINK_IOS_BUNDLE_ID }}
FIREBASE_DEEPLINK_IOS_STORE_ID: ${{ secrets.FIREBASE_DEEPLINK_IOS_STORE_ID }}
FIREBASE_DEEPLINK_SOCIAL_TITLE: ${{ secrets.FIREBASE_DEEPLINK_SOCIAL_TITLE }}
FIREBASE_DEEPLINK_SOCIAL_DESCRIPTION: ${{ secrets.FIREBASE_DEEPLINK_SOCIAL_DESCRIPTION }}
FIREBASE_DEEPLINK_SOCIAL_IMAGE_URL: ${{ secrets.FIREBASE_DEEPLINK_SOCIAL_IMAGE_URL }}
STRIPE_TOKEN: ${{ secrets.STRIPE_TOKEN }}
KUTT_API_URL: ${{ secrets.KUTT_API_URL }}
KUTT_API_KEY: ${{ secrets.KUTT_API_KEY }}
SMALLR_LINKS_API_URL: ${{ secrets.SMALLR_LINKS_API_URL }}
SMALLR_LINKS_API_KEY: ${{ secrets.SMALLR_LINKS_API_KEY }}
NOTIFICATIONS_DISABLED: ${{ secrets.NOTIFICATIONS_DISABLED }}
FIREBASE_MESSAGING_CONFIG: ${{ secrets.FIREBASE_MESSAGING_CONFIG }}
FIREBASE_MESSAGING_CONFIG_PATH: ${{ secrets.FIREBASE_MESSAGING_CONFIG_PATH }}
ONESIGNAL_APP_ID: ${{ secrets.ONESIGNAL_APP_ID }}
ONESIGNAL_APP_KEY: ${{ secrets.ONESIGNAL_APP_KEY }}