-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (71 loc) · 2.62 KB
/
build.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
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
name: build
on:
push:
tags:
branches:
pull_request: { }
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: disable and stop mono-xsp4.service (wtf?)
run: |
sudo systemctl stop mono-xsp4.service || true
sudo systemctl disable mono-xsp4.service || true
- name: set up go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: checkout
uses: actions/checkout@v2
- name: build and test
run: |
go get -v
go test -v ./... -timeout=60s -v -race -p 1 -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "_mock.go" > $GITHUB_WORKSPACE/profile.cov
go build -race
env:
GO111MODULE: "on"
TZ: "Europe/Poland"
- name: install golangci-lint and goveralls
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.39.0
GO111MODULE=off go get -u -v github.com/mattn/goveralls
- name: run linters
run: $GITHUB_WORKSPACE/golangci-lint run
- name: submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: setup QEMU
uses: docker/setup-qemu-action@v1
- name: login to the DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and deploy latest image to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: pochrymowicz/gozdrofit-cli:latest
- name: extract tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: build and deploy release image to DockerHub
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: pochrymowicz/gozdrofit-cli:${{ env.RELEASE_VERSION }}