Skip to content

Commit 52f7838

Browse files
committed
Added github actions workflows
Signed-off-by: Denis Arslanbekov <denis@arslanbekov.com>
1 parent 1fd2eae commit 52f7838

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test Coverage
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
coverage:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: "1.21"
19+
20+
- name: Run tests with coverage
21+
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
22+
23+
- name: Upload coverage to Codecov
24+
uses: codecov/codecov-action@v3
25+
with:
26+
file: ./coverage.txt
27+
fail_ci_if_error: true

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint and Format
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: "1.21"
19+
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v3
22+
with:
23+
version: latest
24+
args: --timeout=5m
25+
26+
- name: Check formatting
27+
run: |
28+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
29+
gofmt -s -l .
30+
exit 1
31+
fi

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: "1.21"
18+
19+
- name: Run GoReleaser
20+
uses: goreleaser/goreleaser-action@v4
21+
with:
22+
version: latest
23+
args: release --clean
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/security.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Security Scan
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 0 * * 0"
10+
11+
jobs:
12+
security:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Run Gosec Security Scanner
18+
uses: securego/gosec@master
19+
with:
20+
args: ./...
21+
22+
- name: Run nancy for dependency scanning
23+
uses: sonatype-nexus-community/nancy-github-action@main

0 commit comments

Comments
 (0)