Skip to content

Commit f091a9d

Browse files
author
amuraru
committed
Add unit tests CI checks
1 parent b0e7a46 commit f091a9d

File tree

4 files changed

+85
-193
lines changed

4 files changed

+85
-193
lines changed

.github/workflows/ci.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
GO_VERSION: '1.25'
15+
16+
jobs:
17+
test:
18+
name: Test
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
24+
- name: Set up Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ env.GO_VERSION }}
28+
cache: true
29+
30+
- name: Download dependencies
31+
run: go mod download
32+
33+
- name: Verify dependencies
34+
run: go mod verify
35+
36+
- name: Run tests
37+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
38+
39+
- name: Upload coverage to Codecov
40+
uses: codecov/codecov-action@v4
41+
with:
42+
files: ./coverage.out
43+
flags: unittests
44+
fail_ci_if_error: false
45+
46+
lint:
47+
name: Lint
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v5
52+
53+
- name: Set up Go
54+
uses: actions/setup-go@v5
55+
with:
56+
go-version: ${{ env.GO_VERSION }}
57+
cache: true
58+
59+
- name: Run golangci-lint
60+
uses: golangci/golangci-lint-action@v8
61+
with:
62+
version: latest
63+
args: --timeout=5m
64+
65+
build:
66+
name: Build
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v5
71+
72+
- name: Set up Go
73+
uses: actions/setup-go@v5
74+
with:
75+
go-version: ${{ env.GO_VERSION }}
76+
cache: true
77+
78+
- name: Build
79+
run: go build -v ./...
80+
81+
- name: Build binary
82+
run: go build -v -o kminion .
83+

.github/workflows/e2e-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: E2E Tests
22

33
on:
44
push:
5-
branches: ["master", "main"]
5+
branches: ["main"]
66
pull_request:
7-
branches: ["master", "main"]
7+
branches: ["main"]
88
workflow_dispatch:
99

1010
jobs:

.github/workflows/snyk-scan.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

e2e/topic_test.go

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)