-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (68 loc) · 2.25 KB
/
imc-grpc-service.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
name: 'imc-grpc-service ci'
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
unit-test:
strategy:
matrix:
go-version: [1.22.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: setup GOPATH into PATH
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- uses: actions/checkout@v2
- name: Run's Golint
working-directory: imc-grpc-service
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
# golint -set_exit_status ./...
- name: Install dependencies
working-directory: imc-grpc-service
run: go get -u
- name: Test
working-directory: imc-grpc-service
run: go test -v
build-docker-artifacts:
needs: [ unit-test ]
runs-on: ubuntu-latest
if: contains(github.ref, 'main')
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.22.x'
- uses: actions/checkout@v1
- name: Docker Build
working-directory: imc-grpc-service
run: docker build -t imc-grpc-service:latest .
- name: Docker Tag Latest
working-directory: imc-grpc-service
run: docker tag imc-grpc-service:latest fidelissauro/imc-grpc-service:latest
- name: Docker Tag Release
run: |
TAG=$(git describe --tags --abbrev=0)
docker tag imc-grpc-service:latest fidelissauro/imc-grpc-service:$TAG
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD}}
- name: Docker Push Latest
working-directory: imc-grpc-service
run: docker push fidelissauro/imc-grpc-service:latest
- name: Docker Push Release Tag
working-directory: imc-grpc-service
run: |
TAG=$(git describe --tags --abbrev=0)
docker push fidelissauro/imc-grpc-service:$TAG