Skip to content

Commit 12c7625

Browse files
committed
Merge branch 'release/v1.3.0' into main
2 parents fa2da23 + 7298ac6 commit 12c7625

26 files changed

+1621
-476
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] <title>"
5+
labels: bug
6+
assignees: QU35T-code
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.

.github/workflows/go.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# This workflow will build a golang project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3-
41
name: Go
52

63
on:
74
push:
85
branches: [ "main", "dev" ]
6+
paths-ignore:
7+
- 'README.md'
98
pull_request:
109
branches: [ "main", "dev" ]
10+
types: [opened, synchronize, reopened, ready_for_review]
1111

1212
jobs:
1313

1414
build:
15+
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && !github.event.pull_request.draft)
1516
runs-on: ubuntu-latest
1617
strategy:
1718
matrix:
@@ -31,3 +32,61 @@ jobs:
3132
GOOS: ${{ matrix.os }}
3233
GOARCH: ${{ matrix.arch }}
3334
run: go build -v ./...
35+
36+
tests:
37+
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && !github.event.pull_request.draft)
38+
needs: build
39+
runs-on: ubuntu-latest
40+
name: Update coverage badge
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
with:
45+
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
46+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
47+
48+
- name: Setup go
49+
uses: actions/setup-go@v2
50+
with:
51+
go-version: '1.19'
52+
53+
- uses: actions/cache@v2
54+
with:
55+
path: ~/go/pkg/mod
56+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
57+
restore-keys: |
58+
${{ runner.os }}-go-
59+
60+
- name: Run Test
61+
run: |
62+
go test -v ./... -covermode=set -coverprofile=coverage.out
63+
go tool cover -func=coverage.out -o=coverage.out
64+
env:
65+
HTB_TOKEN: ${{ secrets.HTB_TOKEN }}
66+
TEST: "true"
67+
68+
- name: Go Coverage Badge
69+
uses: tj-actions/coverage-badge-go@v2
70+
with:
71+
filename: coverage.out
72+
73+
- name: Verify Changed files
74+
uses: tj-actions/verify-changed-files@v12
75+
id: verify-changed-files
76+
with:
77+
files: README.md
78+
79+
- name: Commit changes
80+
if: steps.verify-changed-files.outputs.files_changed == 'true'
81+
run: |
82+
git config --local user.email "[email protected]"
83+
git config --local user.name "GitHub Action"
84+
git add README.md
85+
git commit -m "chore: Updated coverage badge."
86+
87+
- name: Push changes
88+
if: steps.verify-changed-files.outputs.files_changed == 'true'
89+
uses: ad-m/github-push-action@master
90+
with:
91+
github_token: ${{ secrets.TOKEN_PUSH }}
92+
branch: dev

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: '1.20'
24+
25+
- name: Release
26+
uses: goreleaser/goreleaser-action@v4
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.dll
88
*.so
99
*.dylib
10+
.idea
1011

1112
# Test binary, built with `go test -c`
1213
*.test
@@ -19,3 +20,5 @@
1920

2021
# Go workspace file
2122
go.work
23+
coverage.out
24+
htb-cli

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BINARY_NAME=htb-cli
2+
3+
PLATFORMS=darwin linux windows
4+
5+
ARCHITECTURES=amd64 arm64
6+
7+
OUTPUT_DIR=build
8+
9+
all: test coverage $(PLATFORMS)
10+
11+
$(PLATFORMS):
12+
for arch in $(ARCHITECTURES); do \
13+
GOOS=$@ GOARCH=$$arch go build -o $(OUTPUT_DIR)/$(BINARY_NAME)-$@-$$arch; \
14+
done
15+
16+
build:
17+
go build -o $(OUTPUT_DIR)/$(BINARY_NAME)
18+
19+
test:
20+
go test -v ./...
21+
22+
coverage:
23+
go test -coverprofile=coverage.out ./...
24+
go tool cover -html=coverage.out -o coverage.html
25+
26+
clean:
27+
rm -rf $(OUTPUT_DIR) coverage.out coverage.html
28+
29+
.PHONY: all test coverage clean $(PLATFORMS)

0 commit comments

Comments
 (0)