Skip to content

Commit 583d561

Browse files
committed
initial commit
up and running add Makefile and readme github actions implemented remove debugging logs zap used as logger set headers as seperate function ci/cd improvements remove release.yml revert lint in Makefile add upload assets step fix filename add upload assets again add project name retrigger pipeline use plag library fixes #1: demo commit to test auto close fixes #2: proper directory structure change filename add vendor folder to gitignore dummy commit to test commit speed upgrade golang version bump go-version on github actions remove unneccessary log use logger.Fatal instead of panic() remove unneccessary variables add docker pulls badge fix #3: banner created fixes #4: unit testing print response body on error while creating user exclude windows-latest from unit tests temporarily use variables from non-test class fix variable usage go report improvements fix lint error fix goreport errors go mod vendor before ineffassign remove banner fixes #8: multiple email domains added, readme updated fix test errors fixes #6: options managed as struct remove unneccessary logger initialization fix registration problem with the new API fixes #10 upgrade dependencies fix option parsing upgrade deps update makefile exclude go 1.15.x from test/build banner created remove test-cache phase change pkg to internal add pre-commit pre-commit-config added pre-commit-config added update readme codecov use distroless as minimal base image add codecov to actions modify actions coverage order hardcode commands readme badge order update readme update readme formatting update readme update badges Create LICENSE update precommit conf remove debug logs configure zap upgrade deps add codeql action fix unit tests a little bit fix random package unit tests upgrade deps format function comment headers added for missing ones upgrade tool versions, #minor upgrade indirect dependencies upgrade git-tag-action refactor logging and stuff change if/else conditions with global vars new line on first log fix wrong new line set api url as function level variable add newline on banner.txt instead of main.go set variable types handle one more error condition add test case for broken api url fix goreport warnings test broken json response case re-order test functions start using testify/assert while testing use mock server while testing bad request from API fix sonarcloud warnings sonarcloud integration add sonarcloud badge try to display coverage info on UI change file names to match sonarcloud configuration remove windows from github actions remove windows from goreleaser config regenerate go.sum remove unneccessary variable assignments upgrade multiple deps add dependabot.yml upgrade direct deps and pre-commit-hooks remove unneccassary global variable def regenerate go.sum direct dependency upgrade script in Makefile update pre-commit conf enhance github workflows cobra POC, to be continued fix failing github actions update readme [skip ci] update readme restructure add sonar.coverage.exclusions update sonar scanner config exclude paths add comment feature for codecov add coverage step to pr.yml update random.go revert fix codeql problem fix coverage problem remove comment block from codecov.yml test invalid generate length update codecov.yml upgrade go version as 1.17 codecov removed codecov removed (#24) [skip ci] add commitMessage prefix for dependabot upgrade direct deps to test notification behavior on new release remove commitMessage prefix for dependabot Bump go.uber.org/zap from 1.20.0 to 1.21.0 (#25) (#26) Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.20.0 to 1.21.0. - [Release notes](https://github.com/uber-go/zap/releases) - [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md) - [Commits](uber-go/zap@v1.20.0...v1.21.0) --- updated-dependencies: - dependency-name: go.uber.org/zap dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump go.uber.org/zap from 1.20.0 to 1.21.0 (#25) Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.20.0 to 1.21.0. - [Release notes](https://github.com/uber-go/zap/releases) - [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md) - [Commits](uber-go/zap@v1.20.0...v1.21.0) --- updated-dependencies: - dependency-name: go.uber.org/zap dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> change dependabot target branch auto approve dependabot prs into devel style: reformat files and its contents (#27) * reformat files * upgrade direct deps style: change auto-merge file name (#29) * reformat files * upgrade direct deps * Bump github.com/stretchr/testify from 1.7.0 to 1.7.1 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * style: change auto-merge file name Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> style: add new line to test pull request behavior (#30) * reformat files * upgrade direct deps * Bump github.com/stretchr/testify from 1.7.0 to 1.7.1 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * style: change auto-merge file name * style: newline added to test merge behavior Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> style: add new changes (#31) * reformat files * upgrade direct deps * Bump github.com/stretchr/testify from 1.7.0 to 1.7.1 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * style: change auto-merge file name * style: newline added to test merge behavior Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> reformat files upgrade direct deps Bump github.com/stretchr/testify from 1.7.0 to 1.7.1 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> style: change auto-merge file name style: newline added to test merge behavior build: fail pipeline if sonar quality gate fails style: new line style: another new line style: new line style: another new line style: remove new lines test: remove unneccessary debugging logs update goreleaser docs: add homebrew section build: add new token for tap Merge pull request #36 from bilalcaliskan/devel build: add new token for tap feat: automaxprocs added as dependency for POC style: remove unneccessary comment line feat: automaxprocs added as dependency for POC style: remove unneccessary comment line docs: add pre-commit install section chore: upgrade direct deps ci: goreleaser docker build ci: disable quality gate check temp ci: remove wrong dockerfile ci: comment out needs statement build: fix dockerfile build: fix base image ci: refactor flow ci: comment out tag step ci: comment out tag step ci: customize goreleaser ci: re-enable devel branch push ci(goreleaser): remove wrong before hook ci: add vendor command ci: add vendor command ci: modify goreleaser config build: modify goreleaser conf ci: re-enable tag job ci: fix missing dependency problem chore: add Dockerfile for manual build on localhost build: re-enable all steps ci: remove unneccassary jobs in push.yml ci: remove golangci-lint configuration chore: upgrade direct deps ci: upgrade action plugin vertsions build: upgrade action plugins versions chore: upgrade direct deps chore: upgrade deps based on dependabot alerts chore: create build directory and collect ci/packaging related stuff in there fix(#45): show banner on different types of installations(docker, binary, homebrew) chore: upgrade all direct deps style: remove wrong layer on Dockerfile.goreleaser ci: add another exclude statement for changelog generator (style) chore: change default banner file path build: override bannerFilePath argument chore: upgrade direct deps build: add additional files into archive build: add banner properly chore: change location of Makefile ci: fix file Makefile paths on CI jobs fix: fix Makefile rendering problem build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.5 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.5. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.2...v1.7.5) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0 Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](spf13/cobra@v1.4.0...v1.5.0) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.7.5...v1.8.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> chore: upgrade indirect dependencies chore: modify logging docs: modify readme chore: upgrade direct deps feat: add version info feat: add log verbosity support style: remove debugging lines feat: add coverage.sh ci: ensure b flag is passed to make command feat: add dependabot for github actions build(deps): bump dependabot/fetch-metadata from 1.1.1 to 1.3.3 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.1.1 to 1.3.3. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](dependabot/fetch-metadata@v1.1.1...v1.3.3) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> build(deps): bump goreleaser/goreleaser-action from 2 to 3 Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 2 to 3. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](goreleaser/goreleaser-action@v2...v3) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> ci: comment out if condition on auto update revert: revert if condition on auto merge configuration chore: bump golang version as 1.19 feat: add more build related environment into logging chore: bump golangci-lint action version ci: try to fix github actions problems ci: change cron schedule of stale job ci: install ineffassign with go get ci: add errcheck docs: bump golang version ci: makefile improvements ci: tidy makefile ci: fix makefile errors ci: fix target name for sonarcloud test ci: move .revive.toml into build/ci directory ci: get go version from go.mod file build(deps): bump anothrNick/github-tag-action from 1.39.0 to 1.41.0 Bumps [anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action) from 1.39.0 to 1.41.0. - [Release notes](https://github.com/anothrNick/github-tag-action/releases) - [Commits](anothrNick/github-tag-action@1.39.0...1.41.0) --- updated-dependencies: - dependency-name: anothrNick/github-tag-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> ci: add gosec action build(deps): bump anothrNick/github-tag-action from 1.41.0 to 1.46.0 Bumps [anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action) from 1.41.0 to 1.46.0. - [Release notes](https://github.com/anothrNick/github-tag-action/releases) - [Commits](anothrNick/github-tag-action@1.41.0...1.46.0) --- updated-dependencies: - dependency-name: anothrNick/github-tag-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> style: change banner refactor: get read of new line at the end of errors.wrapf build(deps): bump actions/stale from 5 to 6 Bumps [actions/stale](https://github.com/actions/stale) from 5 to 6. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](actions/stale@v5...v6) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> feat: set log level as seperate param fix: proper random generation chore: upgrade direct deps feat: create temp mail over mailslurp chore: bump multiple github action versions feat: create tempmails over 1secmail refactor: handle error on response body close ops test: increase coverage by covering cmd/root.go ci: only ignore main.go on sonar properties test: fix unhandled errors chore: increase --attempCount default value feat: first skeleton of retryable menu feat: add promptui for retryable error handling test: pass missing param to disable interactive menu ci: disable quality gate check temporarily ci: pass CI jobss fix: get rid of buggy validation prompt style: proper logging on error ci: re-enable sonarqube quality check chore: replace logger as sugaredlogger test: fix wrong attemptCount refactor: fix golangci-lint warnings build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](stretchr/testify@v1.8.0...v1.8.1) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> fix: use registerable new domains over different API debug: print token debug: print token ci: pass secret value into jobs initial commit 2 docs: remove banners
0 parents  commit 583d561

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2329
-0
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
target-branch: "devel"
9+
labels:
10+
- "dependabot"
11+
- "gomod"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
target-branch: "devel"
17+
labels:
18+
- "dependabot"
19+
- "github-actions"

.github/workflows/automerge.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Dependabot auto-merge
3+
on: pull_request
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
dependabot:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.actor == 'dependabot[bot]' }}
13+
steps:
14+
- name: Dependabot metadata
15+
id: dependabot-metadata
16+
uses: dependabot/fetch-metadata@v1
17+
- uses: actions/checkout@v4
18+
- name: Approve a PR if not already approved
19+
run: |
20+
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
21+
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
22+
gh pr review --approve "$PR_URL"
23+
else
24+
echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
25+
fi
26+
env:
27+
PR_URL: ${{github.event.pull_request.html_url}}
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
- name: Enable auto-merge for Dependabot PRs for github-actions package ecosystem
30+
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }}
31+
run: gh pr merge --auto --rebase "$PR_URL"
32+
env:
33+
PR_URL: ${{github.event.pull_request.html_url}}
34+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
35+
- name: Enable auto-merge for Dependabot PRs for go_modules package ecosystem
36+
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'go_modules' && steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
37+
run: gh pr merge --auto --rebase "$PR_URL"
38+
env:
39+
PR_URL: ${{github.event.pull_request.html_url}}
40+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/pr.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: PR
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
env:
9+
GO111MODULE: on
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version-file: "go.mod"
20+
cache: true
21+
- name: Lint code
22+
run: make -s lint
23+
- name: Clean downloaded binaries
24+
run: make -s clean
25+
26+
fmt:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Install Go
32+
uses: actions/setup-go@v4
33+
with:
34+
go-version-file: "go.mod"
35+
cache: true
36+
- name: Run fmt
37+
run: make -s fmt
38+
- name: Clean downloaded binaries
39+
run: make -s clean
40+
41+
tests:
42+
strategy:
43+
matrix:
44+
name: [unit, e2e]
45+
runs-on: ubuntu-latest
46+
name: test (${{ matrix.name }})
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
- name: Install Go
51+
uses: actions/setup-go@v4
52+
with:
53+
go-version-file: "go.mod"
54+
cache: true
55+
- name: Run ${{ matrix.name }} tests
56+
run: make -s test-${{ matrix.name }}
57+
env:
58+
API_TOKEN: ${{ secrets.API_TOKEN }}
59+
60+
staticcheck:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
- uses: dominikh/[email protected]
66+
with:
67+
version: "2022.1.3"
68+
69+
codeql:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
- name: Initialize CodeQL
75+
uses: github/codeql-action/init@v2
76+
with:
77+
languages: go
78+
- name: Autobuild
79+
uses: github/codeql-action/autobuild@v2
80+
- name: Perform CodeQL Analysis
81+
uses: github/codeql-action/analyze@v2
82+
83+
sonarcloud:
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
with:
88+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
89+
- name: Install Go
90+
uses: actions/setup-go@v4
91+
with:
92+
go-version-file: "go.mod"
93+
cache: true
94+
- name: Coverage Test
95+
run: make -s test
96+
env:
97+
API_TOKEN: ${{ secrets.API_TOKEN }}
98+
- name: SonarCloud Scan
99+
uses: SonarSource/sonarcloud-github-action@master
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
103+
API_TOKEN: ${{ secrets.API_TOKEN }}
104+
with:
105+
args: >
106+
-Dproject.settings=build/ci/sonar-project.properties
107+
- name: SonarQube Quality Gate check
108+
uses: sonarsource/sonarqube-quality-gate-action@master
109+
timeout-minutes: 5
110+
env:
111+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
112+
113+
builds:
114+
strategy:
115+
matrix:
116+
os: [ubuntu-latest, macos-latest]
117+
runs-on: ${{ matrix.os }}
118+
name: build (${{ matrix.os }})
119+
steps:
120+
- name: Checkout code
121+
uses: actions/checkout@v4
122+
- name: Install Go
123+
uses: actions/setup-go@v4
124+
with:
125+
go-version-file: "go.mod"
126+
cache: true
127+
- name: Build on (${{ matrix.os }})
128+
run: make -s build
129+
env:
130+
API_TOKEN: ${{ secrets.API_TOKEN }}

.github/workflows/push.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
GO111MODULE: on
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version-file: "go.mod"
21+
cache: true
22+
- name: Lint code
23+
run: make -s lint
24+
- name: Clean downloaded binaries
25+
run: make -s clean
26+
27+
fmt:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Install Go
33+
uses: actions/setup-go@v4
34+
with:
35+
go-version-file: "go.mod"
36+
cache: true
37+
- name: Run fmt
38+
run: make -s fmt
39+
- name: Clean downloaded binaries
40+
run: make -s clean
41+
42+
tests:
43+
strategy:
44+
matrix:
45+
name: [unit, e2e]
46+
runs-on: ubuntu-latest
47+
name: test (${{ matrix.name }})
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
- name: Install Go
52+
uses: actions/setup-go@v4
53+
with:
54+
go-version-file: "go.mod"
55+
cache: true
56+
- name: Run ${{ matrix.name }} tests
57+
run: make -s test-${{ matrix.name }}
58+
env:
59+
API_TOKEN: ${{ secrets.API_TOKEN }}
60+
61+
staticcheck:
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
- uses: dominikh/[email protected]
67+
with:
68+
version: "2022.1.3"
69+
70+
codeql:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
- name: Initialize CodeQL
76+
uses: github/codeql-action/init@v2
77+
with:
78+
languages: go
79+
- name: Autobuild
80+
uses: github/codeql-action/autobuild@v2
81+
- name: Perform CodeQL Analysis
82+
uses: github/codeql-action/analyze@v2
83+
84+
sonarcloud:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
90+
- name: Install Go
91+
uses: actions/setup-go@v4
92+
with:
93+
go-version-file: "go.mod"
94+
cache: true
95+
- name: Coverage Test
96+
run: make -s test
97+
env:
98+
API_TOKEN: ${{ secrets.API_TOKEN }}
99+
- name: SonarCloud Scan
100+
uses: SonarSource/sonarcloud-github-action@master
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
104+
API_TOKEN: ${{ secrets.API_TOKEN }}
105+
with:
106+
args: >
107+
-Dproject.settings=build/ci/sonar-project.properties
108+
- name: SonarQube Quality Gate check
109+
uses: sonarsource/sonarqube-quality-gate-action@master
110+
timeout-minutes: 5
111+
env:
112+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
113+
114+
builds:
115+
strategy:
116+
matrix:
117+
os: [ubuntu-latest, macos-latest]
118+
runs-on: ${{ matrix.os }}
119+
name: build (${{ matrix.os }})
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v4
123+
- name: Install Go
124+
uses: actions/setup-go@v4
125+
with:
126+
go-version-file: "go.mod"
127+
cache: true
128+
- name: Build on (${{ matrix.os }})
129+
run: make -s build
130+
env:
131+
API_TOKEN: ${{ secrets.API_TOKEN }}
132+
133+
tag:
134+
runs-on: ubuntu-latest
135+
needs: [lint, fmt, tests, codeql, sonarcloud, staticcheck, builds]
136+
steps:
137+
- name: Checkout
138+
uses: actions/checkout@v4
139+
with:
140+
fetch-depth: '0'
141+
- name: Bump version and push tag
142+
uses: anothrNick/[email protected]
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
WITH_V: true
146+
DEFAULT_BUMP: patch
147+
148+
release:
149+
runs-on: ubuntu-latest
150+
needs: [tag]
151+
steps:
152+
- name: Checkout
153+
uses: actions/checkout@v4
154+
with:
155+
fetch-depth: 0
156+
- name: Set outputs
157+
id: vars
158+
run: |
159+
echo "::set-output name=latest_tag::$(git describe --tags $(git rev-list --tags --max-count=1))"
160+
echo "::set-output name=build_time::$(date -u +'%m-%d-%YT%H:%M:%SZ')"
161+
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
162+
- name: Set up QEMU
163+
uses: docker/setup-qemu-action@v3
164+
- name: Docker Login
165+
uses: docker/login-action@v3
166+
with:
167+
registry: docker.io
168+
username: ${{ github.repository_owner }}
169+
password: ${{ secrets.DOCKER_PASSWORD }}
170+
- name: Install Go
171+
uses: actions/setup-go@v4
172+
with:
173+
go-version-file: "go.mod"
174+
cache: true
175+
- name: Run GoReleaser
176+
uses: goreleaser/goreleaser-action@v5
177+
with:
178+
version: latest
179+
args: release --clean --config build/package/.goreleaser.yaml
180+
env:
181+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182+
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
183+
API_TOKEN: ${{ secrets.API_TOKEN }}

0 commit comments

Comments
 (0)