forked from pedromazala/vagas
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.5 KB
/
test.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
name: Run unit tests
env:
MYSQL_USER: juan
MYSQL_PASSWORD: juan
MYSQL_ROOT_PASSWORD: juan
MYSQL_DATABASE: pagarme_test
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
test:
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
mysql:
# Docker Hub image
image: mysql:8.0
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306
env:
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
# Set health checks to wait until mysql has started
options: >-
--name=mysql
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 10s
--health-retries 10
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: 1.18
- 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/migrate
which migrate
- name: Checkout repo
uses: actions/checkout@v3
- name: Create tables and stored procedures.
run: make database
- name: Test
run: make tests