-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.11 KB
/
ci.yaml
File metadata and controls
47 lines (39 loc) · 1.11 KB
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
# .github/workflows/main.yml
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DB_HOST: 127.0.0.1
DB_USER: api_user
DB_PASSWORD: api_password
DB_NAME: rest_api_db
DB_PORT: 3306
jobs:
run-code-checks:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go
- name: Checkout Code Repo
uses: actions/checkout@v2
- name: Get dependencies
run: go get -v -t -d ./...
- name: Run Linting
run: |
go fmt ./...
go vet ./...
- name: Setup MySQL
run: |
sudo service mysql start
mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS ${{ env.DB_NAME }};"
mysql -u root -proot -e "CREATE USER IF NOT EXISTS '${{ env.DB_USER }}'@'%' IDENTIFIED BY '${{ env.DB_PASSWORD }}';"
mysql -u root -proot -e "GRANT ALL PRIVILEGES ON ${{ env.DB_NAME }}.* TO '${{ env.DB_USER }}'@'%';"
mysql -u root -proot -e "FLUSH PRIVILEGES;"
- name: Run Tests
run: go test