-
Notifications
You must be signed in to change notification settings - Fork 4
91 lines (74 loc) · 1.99 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "**" ]
env:
golang-version: 1.20.2
golangci-lint-version: v1.51.2
docker-registry: ghcr.io
docker-image-name: ${{ github.repository }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.golang-version }}
id: go
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.golangci-lint-version }}
- name: Format
run: |
make fmt
git diff --exit-code .
- name: Build
run: make build
test:
name: unit
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install colima on MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install colima docker && colima start
- name: Set up Go
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.golang-version }}
id: go
- name: Use Go module caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
if: ${{ matrix.os != 'macos-latest' }}
run: make test > unit-run.log 2>&1
- name: Test
if: ${{ matrix.os == 'macos-latest' }}
run: make test > unit-run.log 2>&1
env:
DOCKER_HOST: 'unix:///Users/runner/.colima/default/docker.sock'
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: '/var/run/docker.sock'
- name: 'Print failure logs'
if: ${{ failure() }}
run: cat unit-run.log
- name: 'Upload Log Artifact'
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: unit-run.log
path: unit-run.log
retention-days: 5