-
-
Notifications
You must be signed in to change notification settings - Fork 188
56 lines (47 loc) · 1.39 KB
/
main.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
name: main
on: [push, pull_request]
jobs:
test:
name: Build on ${{ matrix.os }} with Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
go: ['1.20']
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Cache modules
uses: actions/cache@v3.3.1
with:
path: ~/go/pkg/mod
key: ${{ runner.OS }}-go-${{ hashFiles('**/go.sum') }}
- name: Build
run: go build
- name: Lint
run: go vet ./...
- name: Test
run: go test -p 1 -coverpkg ./... -covermode atomic -coverprofile coverage.txt ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.4
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
test-docker-image-building:
name: Test docker image building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/build-push-action@v4 # Action page: <https://github.com/docker/build-push-action>
with:
context: .
file: Dockerfile
push: false
tags: app:ci
- run: docker run --rm app:ci --version