forked from tsuru/tsuru-client
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (95 loc) · 2.82 KB
/
go.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Go
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest'
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/checkout@v1
- run: make metalint
docker_deploy:
name: "publish image on dockerhub"
if: github.event_name != 'pull_request'
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: Surgo/docker-smart-tag-action@v1
id: smarttag
with:
docker_image: tsuru/client
default_branch: master
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v2
with:
file: ./Dockerfile
push: true
tags: ${{ steps.smarttag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
deploy:
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/checkout@v1
- name: rc release
uses: goreleaser/goreleaser-action@v2
if: contains(github.ref, '-rc')
with:
args: --config goreleaser-rc.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: stable release
uses: goreleaser/goreleaser-action@v2
if: "!contains(github.ref, '-rc')"
with:
args: --config goreleaser-stable.yml
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.5'
- name: packagecloud
env:
PACKAGE_NAME: tsuru-client
PACKAGECLOUD_TOKEN: ${{secrets.PACKAGECLOUD_TOKEN}}
SKIP_GORELEASER: "true"
run: |
curl -sL https://raw.githubusercontent.com/tsuru/push-to-packagecloud/master/push.sh | bash