Skip to content

deps: bump golang from 1.24-alpine to 1.25-alpine #68

deps: bump golang from 1.24-alpine to 1.25-alpine

deps: bump golang from 1.24-alpine to 1.25-alpine #68

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
GO_VERSION: '1.24'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: alexander
POSTGRES_PASSWORD: alexander
POSTGRES_DB: alexander_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Download dependencies
run: go mod download
- name: Run tests
env:
ALEXANDER_DATABASE_HOST: localhost
ALEXANDER_DATABASE_PORT: 5432
ALEXANDER_DATABASE_USER: alexander
ALEXANDER_DATABASE_PASSWORD: alexander
ALEXANDER_DATABASE_DATABASE: alexander_test
ALEXANDER_REDIS_HOST: localhost
ALEXANDER_REDIS_PORT: 6379
ALEXANDER_AUTH_ENCRYPTION_KEY: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build binaries
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/alexander-server-linux-amd64 ./cmd/alexander-server
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/alexander-server-linux-arm64 ./cmd/alexander-server
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/alexander-server-darwin-amd64 ./cmd/alexander-server
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o bin/alexander-server-darwin-arm64 ./cmd/alexander-server
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o bin/alexander-server-windows-amd64.exe ./cmd/alexander-server
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: bin/
retention-days: 7
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: alexander-storage:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max