-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (63 loc) · 2.22 KB
/
main.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
name: Build and Publish Docker
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
services:
postgres:
# pulling docker hub
image: postgres:latest # same with the one which is written on docker-compose
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: dummydb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Set up Go 1.15
uses: actions/setup-go@v3
with:
go-version: 1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Download example config file
run: |
curl -o config.yml https://gist.githubusercontent.com/mrtrkmn/cc5becf2d8413ea18c27a5bb2aa4106f/raw/2fc5b3fd415846f0b993a67d20d0094309f00698/config.yml
- name: Download certs
run: |
curl -o haaukins-store.com.crt https://gitlab.com/-/snippets/2352549/raw/main/haaukins-store.com.crt
curl -o localhost_50051.key https://gitlab.com/-/snippets/2352547/raw/main/localhost_50051.key
curl -o localhost_50051.crt https://gitlab.com/-/snippets/2352548/raw/main/localhost_50051.crt
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build and Run Server
run: |
go build -o server .
chmod +x ./server
./server &
- name: Run Tests
run: go test -v ./...
env:
CERT: ./../localhost_50051.crt
CERT_KEY: ./../localhost_50051.key
CA: ./../haaukins-store.com.crt
- name: Teardown resources # more stuff could be added in the future
run : |
rm -rf config.yml
rm -rf *.crt *.key