-
Notifications
You must be signed in to change notification settings - Fork 10
88 lines (88 loc) · 2.44 KB
/
ci.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
#name: CI
#
#on:
# push:
# branches: [main]
# pull_request:
# branches: [main]
#
#jobs:
# CI:
# runs-on: ubuntu-20.04
#
# steps:
#
# # Step 1: Checkout the code
# - uses: actions/checkout@v2
#
# # Step 2: Set up Go environment
# - name: Set up Go
# uses: actions/setup-go@v2
# with:
# go-version: 1.23
#
# # Step 3: Cache Go modules (dependencies)
# - name: Cache Go modules
# id: cache-go-modules
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache/go-build
# /go/pkg/mod
# key: go-mod-${{ hashFiles('unccord-bot-go/go.sum') }}
# restore-keys: |
# go-mod-
#
# # Step 4: Install dependencies
# - name: Install dependencies
# working-directory: unccord-bot-go
# run: go mod tidy && go mod verify
# if: steps.cache-go-modules.outputs.cache-hit != 'true' # Only run if cache is not found
#
# # Step 5: Cache Go build (object cache)
# - name: Cache Go build
# uses: actions/cache@v2
# with:
# path: |
# ./unccord-bot-go
# key: go-build-${{ hashFiles('unccord-bot-go/go.sum', 'unccord-bot-go/**/*.go') }}-${{ runner.os }}-build
# restore-keys: |
# go-build-${{ runner.os }}-build
#
# # Step 6: Build the application
# - name: Build
# working-directory: unccord-bot-go
# run: go build ./cmd/main.go
#
# # Step 7: Run unit tests with race detection and generate coverage report
# - name: Run unit tests with coverage
# working-directory: unccord-bot-go
# run: go test -race -coverprofile=coverage.out ./...
#
# # Step 8: Upload test coverage report (optional, useful if using a coverage service)
# - name: Upload test coverage report
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: unccord-bot-go/coverage.out
#
# # Step 9: Run go vet for static analysis
# - name: Run go vet
# working-directory: unccord-bot-go
# run: go vet ./...
#
# # Step 10: Install golint for linting
# - name: Install golint
# working-directory: unccord-bot-go
# run: go install golang.org/x/lint/golint@latest
#
# # Step 11: Run golint to check for code quality issues
# - name: Run golint
# working-directory: unccord-bot-go
# run: golint ./...
#
# # Step 12: Post PR summary comment (Optional)
# # - name: Post PR summary
#
# # Step 13: Add label to PR
# # - name: Add label to PR