-
Notifications
You must be signed in to change notification settings - Fork 17
66 lines (55 loc) · 2.07 KB
/
ci.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
name: build
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: set up go 1.20
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go
- name: checkout
uses: actions/checkout@v3
- name: test
run: |
go test -v -mod=vendor -timeout=60s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mock_" > $GITHUB_WORKSPACE/profile.cov
working-directory: backend/app
env:
TZ: "America/Chicago"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: backend
- name: install goveralls
run: go install github.com/mattn/goveralls@latest
working-directory: backend
- name: build
run: go build -v -mod=vendor
working-directory: backend/app
- name: submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: backend
- name: build pr image
if: github.event_name == 'pull_request'
run: docker build -t umputun/secrets:master .
- name: build and push master image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker build -t umputun/secrets:master .
docker login --username ${{ secrets.DOCKERHUB_USER }} --password ${{ secrets.DOCKERHUB_PASSWD }}
docker push umputun/secrets:master
- name: build and push tagged image
if: github.event_name == 'push' && github.event.ref_type == 'tag'
run: |
GIT_TAG="${GITHUB_REF#refs/tags/}"
docker build -t umputun/secrets:${GIT_TAG} .
docker login --username ${{ secrets.DOCKERHUB_USER }} --password ${{ secrets.DOCKERHUB_PASSWD }}
docker push umputun/secrets:${GIT_TAG}
docker tag umputun/secrets:${GIT_TAG} umputun/secrets:latest
docker push umputun/secrets:latest