Skip to content

Commit df5b0af

Browse files
committed
Add GitHub Actions workflow for building the application; update Makefile package path
1 parent ff55159 commit df5b0af

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: Build on Ubuntu
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: '1.26.4'
24+
25+
- name: Cache Go modules
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cache/go-build
30+
${{ github.workspace }}/pkg/mod
31+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
32+
restore-keys: |
33+
${{ runner.os }}-go-
34+
35+
- name: Install dependencies
36+
run: go mod download
37+
38+
- name: Build application
39+
run: make build
40+
41+
- name: Validate binary exists
42+
run: test -f bin/server

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for goding - build, test, run the server
22

33
BINARY := bin/server
4-
PKG := ./cmd/server
4+
PKG := main.go
55

66
.PHONY: all build test run clean help
77

0 commit comments

Comments
 (0)