Skip to content

feat(update): changelog - unreleased #6

feat(update): changelog - unreleased

feat(update): changelog - unreleased #6

Workflow file for this run

name: Test & Build
on:
push:
branches:
- master
- main
- develop
pull_request:
branches:
- master
- main
- develop
jobs:
test-build:
name: Test & Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: nodebyte_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
cache: true
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U testuser; do
echo 'waiting for postgres...'
sleep 1
done
env:
PGPASSWORD: testpass
- name: Run go fmt check
run: |
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "Code not formatted with gofmt:"
echo "$UNFORMATTED"
exit 1
fi
- name: Run go vet
run: go vet ./...
- name: Run unit tests
run: go test -v -race -cover ./...
env:
DATABASE_URL: "postgres://testuser:testpass@localhost:5432/nodebyte_test?sslmode=disable"
REDIS_URL: "redis://localhost:6379"
ENCRYPTION_KEY: "test-encryption-key-32-bytes-long!"
- name: Build binary
run: go build -v -o bin/nodebyte-backend ./cmd/api
env:
CGO_ENABLED: 1
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: nodebyte-backend-linux
path: bin/nodebyte-backend
retention-days: 5
- name: Check binary size
run: |
SIZE=$(stat -f%z bin/nodebyte-backend 2>/dev/null || stat -c%s bin/nodebyte-backend)
SIZE_MB=$((SIZE / 1024 / 1024))
echo "Binary size: ${SIZE_MB}MB"
if [ $SIZE_MB -gt 100 ]; then
echo "⚠️ Warning: Binary size is large (${SIZE_MB}MB), consider optimizing"
fi