-
Notifications
You must be signed in to change notification settings - Fork 11
144 lines (124 loc) · 4.65 KB
/
Copy pathmain.yml
File metadata and controls
144 lines (124 loc) · 4.65 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Tests & CrossBuild & DockerBuild
on: [push]
jobs:
golangci:
name: Linter checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
args: --exclude 'unused' --timeout=10m
test-build:
name: Tests & CrossBuild
runs-on: ubuntu-18.04
steps:
- name: Set GOPATH
run: |
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV
echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
shell: bash
- name: Install Go 1.14.6
uses: actions/setup-go@v1
with:
go-version: 1.14.6
id: go
- name: Checkout
uses: actions/checkout@v2
with:
path: go/src/github.com/${{ github.repository }}
- name: Get dependencies
run: |
cd go/src/github.com/${{ github.repository }}
go mod download
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Make binaries for integration tests
run: |
cd go/src/github.com/${{ github.repository }}
make
- name: Run UNIT tests
run: |
cd go/src/github.com/${{ github.repository }}
go test -v ./... --tags=unit
- name: Run CLI tests
run: |
cd go/src/github.com/${{ github.repository }}
go test -v ./... --tags=cli
- name: Run REST tests
run: |
cd go/src/github.com/${{ github.repository }}
go test -v ./... --tags=rest
- name: Run INTEG tests
run: |
# Build DVM Docker tag used for integ tests
export DN_DVM_INTEG_TESTS_DOCKER_TAG=${DN_DVM_INTEG_TESTS_DOCKER_TAG_DEFAULT}
export REPO_TAG="${GITHUB_REF##*/}"
echo "REPO_TAG: ${REPO_TAG}"
if [[ "${REPO_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then
export DN_DVM_INTEG_TESTS_DOCKER_TAG="release-${REPO_TAG%.*}"
elif [[ "${REPO_TAG}" =~ ^release-v[0-9]+.[0-9]+$ ]]; then
export DN_DVM_INTEG_TESTS_DOCKER_TAG="${REPO_TAG}"
fi
echo "DN_DVM_INTEG_TESTS_DOCKER_TAG: ${DN_DVM_INTEG_TESTS_DOCKER_TAG}"
#
docker login -u ${OWN_REGISTRY_USR} --password-stdin ${DN_DVM_INTEG_TESTS_DOCKER_REGISTRY} <<< ${OWN_REGISTRY_PWD}
docker image pull ${DN_DVM_INTEG_TESTS_DOCKER_REGISTRY}/dfinance/dvm:${DN_DVM_INTEG_TESTS_DOCKER_TAG}
cd go/src/github.com/${{ github.repository }}
go test -v ./... --tags=integ
docker logout
env:
DN_DVM_INTEG_TESTS_USE: docker
DN_DVM_INTEG_TESTS_DOCKER_REGISTRY: ${{ secrets.OWN_REGISTRY }}
DN_DVM_INTEG_TESTS_DOCKER_TAG_DEFAULT: master
OWN_REGISTRY_USR: ${{ secrets.OWN_REGISTRY_USR }}
OWN_REGISTRY_PWD: ${{ secrets.OWN_REGISTRY_PWD }}
- name: Run Sentry INTEG tests
run: |
cd go/src/github.com/${{ github.repository }}
go test -v ./... --tags=integ_sentry
env:
DN_SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
DN_SENTRY_TEST_TOKEN: ${{ secrets.DN_SENTRY_TEST_TOKEN }}
- name: Make binaries crossbuild
run: |
cd go/src/github.com/${{ github.repository }}
make binaries
- name: GitHub Release
uses: softprops/action-gh-release@v1
if: success() && startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
go/src/github.com/${{ github.repository }}/builds/dncli-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker-build:
name: Docker Build
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: '[OwnRegistry] Build and push docker image'
uses: dfinance/gh-actions@master
with:
name: registry.wings.toys/dfinance/dnode
username: ${{ secrets.OWN_REGISTRY_USR }}
password: ${{ secrets.OWN_REGISTRY_PWD }}
dockerfile: ./.build/Dockerfile
build_params: --build-arg CI_PIPELINE_ID=${{ github.run_id }} --build-arg CI_COMMIT_REF_NAME=${{ github.ref }} --build-arg CI_COMMIT_SHA=${{ github.sha }}
registry: registry.wings.toys
cache: true
- name: '[DockerHub] Build and push docker image'
uses: dfinance/gh-actions@master
# if: success() && startsWith(github.ref, 'refs/tags/')
with:
name: dfinance/dnode
username: ${{ secrets.DH_REGISTRY_USR }}
password: ${{ secrets.DH_REGISTRY_PWD }}
dockerfile: ./.build/Dockerfile
build_params: --build-arg CI_PIPELINE_ID=${{ github.run_id }} --build-arg CI_COMMIT_REF_NAME=${{ github.ref }} --build-arg CI_COMMIT_SHA=${{ github.sha }}
cache: true