-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (63 loc) · 2.06 KB
/
go.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
name: Go
on:
push:
branches:
- main
- dev
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
POSTGRES_DB: backupdatabase
POSTGRES_USER: backupuser
POSTGRES_PASSWORD: backupuserpassword
POSTGRES_PORT: 5432
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_DB: backupdatabase
POSTGRES_USER: backupuser
POSTGRES_PASSWORD: backupuserpassword
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install Flyway
run: wget -qO- https://download.red-gate.com/maven/release/com/redgate/flyway/flyway-commandline/10.0.0/flyway-commandline-10.0.0-linux-x64.tar.gz | tar xvz && sudo ln -s `pwd`/flyway-10.0.0/flyway /usr/local/bin
- name: DB Migration
run: flyway migrate -url=jdbc:postgresql://$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB -user=$POSTGRES_USER -password=$POSTGRES_PASSWORD -locations=filesystem:./resources/migrations
- name: Set up Go ^1.22
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Get dependencies
run: go get -v -t -d ./...
- name: Set fake google default credentials
run: |
echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/resources/credentials/fake-service-account.json" >> $GITHUB_ENV
- name: Test
run: |
set -o pipefail
mkdir output
go test -v -p 1 ./... | tee output/tmp-test-output.txt
- name: Testing Report
if: always()
run: ./.github/scripts/report.sh output/tmp-test-output.txt
- name: Build
run: go build -v ./...
- name: Static Folder Artifact
uses: actions/upload-artifact@v4
with:
name: static-folder
path: static