Skip to content

Commit abd85b8

Browse files
committed
chore: Update Makefile and GitHub Actions for improved CI/CD
1 parent 9984698 commit abd85b8

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

.github/workflows/go.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,23 @@ jobs:
1414
build:
1515
name: Build & Test
1616
runs-on: ubuntu-latest
17+
18+
# Set GOPRIVATE to prevent fetching internal packages externally
1719
env:
1820
GOPRIVATE: github.com/co-browser/agent-browser
21+
1922
steps:
2023
- name: Check out code
2124
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1 # Shallow clone for faster checkout
2227

2328
- name: Set up Go
2429
uses: actions/setup-go@v5
2530
with:
2631
go-version: '1.24'
32+
check-latest: true
33+
cache: true # Enable Go module cache
2734

2835
- name: Setup tools
2936
run: make setup
@@ -34,9 +41,11 @@ jobs:
3441
- name: Check formatting
3542
run: |
3643
make fmt
37-
# Check if git status is clean after formatting
38-
if ! git diff --exit-code; then
44+
FORMAT_DIFF=$(git diff)
45+
if [ -n "$FORMAT_DIFF" ]; then
3946
echo "Code is not formatted correctly. Run 'make fmt' locally."
47+
echo "The following files need formatting:"
48+
git diff --name-only
4049
exit 1
4150
fi
4251
@@ -45,6 +54,17 @@ jobs:
4554

4655
- name: Run tests
4756
run: make test
57+
# Show test coverage if any tests exist
58+
if: success()
59+
continue-on-error: true
4860

4961
- name: Build application
50-
run: make build
62+
run: make build
63+
64+
- name: Archive build artifacts
65+
if: success()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: agent-browser-binary
69+
path: out/agent-browser
70+
retention-days: 7

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fmt:
5050

5151
tidy:
5252
@echo "Tidying modules..."
53-
@go mod tidy
53+
@GOPRIVATE=github.com/co-browser/agent-browser go mod tidy
5454

5555
lint:
5656
@echo "Linting code... (requires golangci-lint)"

internal/web/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewServer(mux *http.ServeMux) *http.Server {
3333
// Renamed to be exported.
3434
func RegisterWebServerHooks(lifecycle fx.Lifecycle, server *http.Server, logger log.Logger) {
3535
lifecycle.Append(fx.Hook{
36-
OnStart: func(ctx context.Context) error {
36+
OnStart: func(_ context.Context) error {
3737
go func() {
3838
logger.Info().Str("addr", server.Addr).Msg("Starting HTTP server")
3939
if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {

0 commit comments

Comments
 (0)