Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go Build & Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'

- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
$GOPATH/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod tidy

- name: Build server
run: go build -v -o server ./server.go

- name: Build client
run: go build -v -o client ./client.go

- name: Run tests (if available)
run: |
if ls *_test.go > /dev/null 2>&1 || find . -name '*_test.go' | grep .; then
echo "Running tests..."
go test -v ./...
else
echo "No tests found, skipping tests."
fi
Loading