-
Notifications
You must be signed in to change notification settings - Fork 11
160 lines (157 loc) · 5.08 KB
/
default.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: default
on: push
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.45.2
args: --timeout 2m
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Run unit tests
run: make test
acc-tests:
runs-on: ubuntu-latest
name: acc-tests
env:
REVIZOR_URL: ${{ secrets.REVIZOR_URL }}
REVIZOR_TOKEN: ${{ secrets.REVIZOR_TOKEN }}
SCALR_TOKEN: ${{ secrets.SCALR_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Set API_BRANCH
if: ${{ contains(github.event.head_commit.message, '[API_BRANCH]') }}
run: echo "API_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Set DB_BRANCH
if: ${{ contains(github.event.head_commit.message, '[DB_BRANCH]') }}
run: echo "DB_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Create container
id: create
uses: Scalr/gh-action-revizor@master
with:
command: create
- name: Run acceptance tests
env:
SCALR_HOSTNAME: ${{ steps.create.outputs.hostname }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make testacc
- name: Install goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github
- name: Delete container
id: delete
if: ${{ always() && steps.create.outputs.container_id }}
uses: Scalr/gh-action-revizor@master
with:
command: delete
container_id: ${{ steps.create.outputs.container_id }}
upload-dev:
name: upload-dev
needs: [lint, unit-tests, acc-tests]
runs-on: ubuntu-latest
steps:
- name: Import GPG key
id: import_gpg
uses: Scalr/ghaction-import-gpg@v2.1.1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.DEV_GCP_PROJECT_ID }}
service_account_key: ${{ secrets.DEV_GCP_SA_KEY }}
export_default_credentials: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create dev-tag
run: |
BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's|\(.*\)|\L\1|g;s|/|-|g')
git tag v1.0.0-rc-$BRANCH
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: v1.8.3
args: release --skip-publish
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Upload provider to registry
env:
DOMAIN: ${{ secrets.DEV_DOMAIN }}
BUCKET_NAME: ${{ secrets.DEV_BUCKET_NAME }}
GPG_KEY_ID: ${{ steps.import_gpg.outputs.fingerprint }}
GPG_PUB_KEY: ${{ steps.import_gpg.outputs.pubkey }}
run: bash scripts/upload.sh
release:
name: release
if: startsWith(github.ref, 'refs/tags/')
# needs: [lint, unit-tests, acc-tests]
runs-on: ubuntu-latest
steps:
- name: Validate tag
uses: rubenesp87/semver-validation-action@0.0.6
with:
version: ${{ github.ref_name }}
- name: Import GPG key
id: import_gpg
uses: Scalr/ghaction-import-gpg@v2.1.1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Upload provider to registry
env:
DOMAIN: ${{ secrets.DOMAIN }}
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
GPG_KEY_ID: ${{ steps.import_gpg.outputs.fingerprint }}
GPG_PUB_KEY: ${{ steps.import_gpg.outputs.pubkey }}
run: bash scripts/upload.sh