Skip to content

[robert plant voice] i got a whole lotta diffs #279

[robert plant voice] i got a whole lotta diffs

[robert plant voice] i got a whole lotta diffs #279

Workflow file for this run

name: Go CI
on:
push:
branches: [ "main" ]
paths:
- "acp/**"
- ".github/workflows/go-ci.yml"
pull_request:
branches: [ "main" ]
paths:
- "acp/**"
- ".github/workflows/go-ci.yml"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: acp/go.sum
- name: Cache acp tools
uses: actions/cache@v4
with:
path: acp/bin
key: ${{ runner.os }}-acp-bin-${{ hashFiles('acp/Makefile') }}
- name: Generate mocks
working-directory: acp
run: make mocks
- name: Install golangci-lint
working-directory: acp
run: make golangci-lint
- name: Check formatting
working-directory: acp
run: |
make fmt
if [[ -n $(git diff) ]]; then
echo "::error::Code is not properly formatted. Run 'make fmt' locally."
git diff
exit 1
fi
- name: Run linter
working-directory: acp
run: make lint
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: acp/go.sum
- name: Cache acp tools
uses: actions/cache@v4
with:
path: acp/bin
key: ${{ runner.os }}-acp-bin-${{ hashFiles('acp/Makefile') }}
- name: Generate mocks
working-directory: acp
run: make mocks
- name: Run tests
working-directory: acp
run: make test
- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: test-coverage
path: acp/cover.out
retention-days: 7
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
cache-dependency-path: acp/go.sum
- name: Cache acp tools
uses: actions/cache@v4
with:
path: acp/bin
key: ${{ runner.os }}-acp-bin-${{ hashFiles('acp/Makefile') }}
- name: Generate mocks
working-directory: acp
run: make mocks
- name: Build
working-directory: acp
run: make build
# E2E tests are temporarily disabled due to configuration issues
#
# Issues encountered:
# 1. The e2e test suite has a hardcoded image name "example.com/acp:v0.0.1" in e2e_suite_test.go
# 2. The test expects controller-manager pods to be created in the acp-system namespace
# 3. Attempts to fix:
# - Setting KIND_CLUSTER environment variable to match the KinD cluster name
# - Modifying the Makefile to check for the correct cluster name
# - Trying to use the same image name that's hardcoded in the tests
# 4. The controller-manager pods never get created successfully during CI
#
# TODO:
# - Fix the e2e test configuration to work properly in CI
# - Consider making the test image name configurable instead of hardcoded
# - Debug why the controller-manager pods aren't being created/started correctly
#
# e2e-test:
# name: E2E Tests
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: '1.24'
# cache: true
# cache-dependency-path: acp/go.sum
#
# - name: Setup KinD
# uses: helm/[email protected]
# with:
# cluster_name: acp-example-cluster
# config: acp-example/kind/kind-config.yaml
#
# - name: Set timestamp
# id: timestamp
# run: echo "TIMESTAMP=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
#
# - name: Fix test-e2e check for cluster
# working-directory: acp
# run: |
# # Temporarily modify the Makefile to check for acp-example-cluster instead of 'kind'
# sed -i 's/@kind get clusters | grep -q '"'"'kind'"'"'/@kind get clusters | grep -q '"'"'acp-example-cluster'"'"'/' Makefile
#
# - name: Build and load controller image
# working-directory: acp
# env:
# IMG: controller:${{ env.TIMESTAMP }}
# run: make docker-build && kind load docker-image controller:${{ env.TIMESTAMP }} --name acp-example-cluster
#
# - name: Run e2e tests
# working-directory: acp
# env:
# KIND_CLUSTER: acp-example-cluster
# IMG: controller:${{ env.TIMESTAMP }}
# run: make test-e2e
docker:
name: Docker Build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [lint, test, build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
working-directory: acp
run: make docker-build