Skip to content

Merge pull request #36 from persys-dev/persysctl/pkg-minor-updates #14

Merge pull request #36 from persys-dev/persysctl/pkg-minor-updates

Merge pull request #36 from persys-dev/persysctl/pkg-minor-updates #14

name: Compute Agent CI
on:
push:
branches: [ main, master ]
paths:
- 'compute-agent/**'
- 'pkg/**'
- 'sdk/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/compute-agent-ci.yml'
pull_request:
branches: [ main, master ]
paths:
- 'compute-agent/**'
- 'pkg/**'
- 'sdk/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/compute-agent-ci.yml'
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod # Point to service go.mod
cache: true
- name: Run unit tests with race and coverage
run: |
cd compute-agent
make test-unit || go test ./... -race -coverprofile=coverage.txt
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: unit-coverage
path: compute-agent/coverage.txt
if-no-files-found: warn
e2e-tests:
name: End-to-End Tests
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod
cache: true
- name: Run end-to-end tests
run: |
cd compute-agent
make test-e2e
build-binaries:
name: Build Binaries
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod
cache: true
- name: Build agent and client
run: |
cd compute-agent
go build -v ./cmd/agent
go build -v ./examples/client
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build optimized runtime image
uses: docker/build-push-action@v6
with:
context: . # Root context (needed for pkg/)
file: ./compute-agent/Dockerfile
target: runtime
push: false
tags: persys/compute-agent:ci-runtime
cache-from: type=gha
cache-to: type=gha,mode=max