-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 1.89 KB
/
test.yaml
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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Run test
on:
push:
branches: ["main"]
pull_request:
branches: ["main", "dev"]
jobs:
test:
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: root
POSTGRES_DB: wallet
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Install Golang Migrate
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/bin/
- name: Run migrations
run: make migrate-up
- name: Create test env
run: |
echo "DB_DRIVER=postgres" >> app.env
echo "DB_SOURCE=postgres://root:password@localhost:5432/wallet?sslmode=disable" >> app.env
echo "SERVER_ADDRESS=0.0.0.0:8080" >> app.env
echo "JWT_SECRET_KEY=DCKNKVKENCHEKFBSNEUEaksdnecskecwhikehecjsmcowlcjlscjwolc" >> app.env
echo "ACCESS_TOKEN_DURATION=20m" >> app.env
echo "REFRESH_TOKEN_DURATION=100000m" >> app.env
- name: Test
run: make test
env:
DB_DRIVER: postgres
DB_SOURCE: postgres://root:password@localhost:5432/wallet?sslmode=disable
SERVER_ADDRESS: 0.0.0.0:8080