-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (60 loc) · 2 KB
/
build-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
61
name: Build & Test
on:
push:
branches: "**"
pull_request:
branches: [master]
env:
DOCKER_ENV_FILE: ".github/workflows/docker.env"
jobs:
build-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12.4-alpine # should be the same version as used in .drone.yml, .github/workflows, Dockerfile and live
env:
POSTGRES_DB: "development"
POSTGRES_USER: "dbuser"
POSTGRES_PASSWORD: "dbpass"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
integresql:
image: allaboutapps/integresql:latest
env:
PGHOST: "postgres"
PGUSER: "dbuser"
PGPASSWORD: "dbpass"
mailhog:
image: mailhog/mailhog
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build --target builder --file Dockerfile --tag allaboutapps/go-starter:${GITHUB_SHA:8} .
- name: Create container
run: docker run -d --env-file $DOCKER_ENV_FILE --network "${{ job.services.postgres.network }}" --name=builder -it allaboutapps/go-starter:${GITHUB_SHA:8}
- name: make tidy
run: docker exec builder make tidy
- name: make build
run: docker exec builder make build
- name: make test
run: docker exec builder make test
- name: git diff --exit-code
run: docker cp builder:/app ./post-build && git -C post-build diff --exit-code
- name: Stop container
if: ${{ always() }}
run: docker stop builder
- name: Remove container
if: ${{ always() }}
run: docker rm builder
swagger-codegen-cli:
runs-on: ubuntu-latest
container: swaggerapi/swagger-codegen-cli
steps:
- uses: actions/checkout@v2
- name: run the main swagger.yml validation
run: java -jar /opt/swagger-codegen-cli/swagger-codegen-cli.jar validate -i ./api/swagger.yml