Skip to content

chore: refactor, fix docker images build #19

chore: refactor, fix docker images build

chore: refactor, fix docker images build #19

Workflow file for this run

# CI:Runner Agent 的测试与构建
name: CI (Agent)
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
env:
GO_VERSION: "1.26.0"
WORKING_DIR: .
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect Go module root
id: modroot
uses: ./.github/actions/detect-go-module-root
with:
working_dir: ${{ env.WORKING_DIR }}
- name: Set up Go
if: steps.modroot.outputs.found == 'true'
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: ${{ steps.modroot.outputs.root }}/go.sum
- name: Vet
if: steps.modroot.outputs.found == 'true'
run: go vet ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Lint
if: steps.modroot.outputs.found == 'true'
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --max-same-issues=100000 ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Run tests
if: steps.modroot.outputs.found == 'true'
run: go test -v ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Skip (no project structure)
if: steps.modroot.outputs.found != 'true'
run: 'echo "Skipped: no go.mod + cmd/runner-agent in this repo."'
build:
name: Build
runs-on: ubuntu-latest
needs: [test]
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect Go module root
id: modroot
uses: ./.github/actions/detect-go-module-root
with:
working_dir: ${{ env.WORKING_DIR }}
- name: Set up Go
if: steps.modroot.outputs.found == 'true'
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: ${{ steps.modroot.outputs.root }}/go.sum
- name: Build Runner Agent
if: steps.modroot.outputs.found == 'true'
run: go build -o runner-agent ./cmd/runner-agent
working-directory: ${{ steps.modroot.outputs.root }}
- name: Verify binary
if: steps.modroot.outputs.found == 'true'
run: test -x runner-agent && ls -la runner-agent
working-directory: ${{ steps.modroot.outputs.root }}
- name: Skip (no project structure)
if: steps.modroot.outputs.found != 'true'
run: 'echo "Skipped: no go.mod + cmd/runner-agent in this repo."'