-
Notifications
You must be signed in to change notification settings - Fork 10
54 lines (54 loc) · 1.77 KB
/
unit-tests.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
name: Build, Unit Tests and Linter
on:
push:
branches:
- '**'
paths:
- '**.go'
- 'Gopkg.lock'
- 'Gopkg.toml'
- '.golangci.yml'
- 'Dockerfile.ci-test'
- '.dockerignore'
- '.github/workflows/*-tests.yaml'
pull_request:
branches:
- '**'
jobs:
test:
name: Build, Unit Tests and Linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push ci-test Docker image
uses: docker/build-push-action@v3
with:
file: Dockerfile.ci-test
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: tfgco/pusher:ci-test
- name: Set up go vendor cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-build-${{ hashFiles('Gopkg.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('Gopkg.lock') }}
${{ runner.os }}-build-
- name: Build
run: docker run -v $PWD:/go/src/github.com/topfreegames/pusher tfgco/pusher:ci-test go build -v -o bin/pusher main.go
- name: Test
run: docker run -v $PWD:/go/src/github.com/topfreegames/pusher tfgco/pusher:ci-test ginkgo -v -r --randomizeAllSpecs --randomizeSuites --cover --focus="\[Unit\].*" .
- name: Lint
continue-on-error: true
run: docker run -v $PWD:/go/src/github.com/topfreegames/pusher tfgco/pusher:ci-test golangci-lint run