Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
pull_request:
branches: [main]

env:
GO_VERSION: "1.25.5"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -23,10 +26,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Go
id: setup-go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25.5"
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum

- name: Go cache status
run: echo "cache-hit=${{ steps.setup-go.outputs.cache-hit }}"

- name: Lint
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
Expand All @@ -40,10 +48,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Go
id: setup-go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25.5"
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum

- name: Go cache status
run: echo "cache-hit=${{ steps.setup-go.outputs.cache-hit }}"

- name: Install Task
uses: go-task/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1.0.0
Expand All @@ -60,10 +73,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Go
id: setup-go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25.5"
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum

- name: Go cache status
run: echo "cache-hit=${{ steps.setup-go.outputs.cache-hit }}"

- name: Install go-licences
run: go install github.com/google/go-licenses@latest
Expand All @@ -79,10 +97,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Go
id: setup-go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25.5"
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum

- name: Go cache status
run: echo "cache-hit=${{ steps.setup-go.outputs.cache-hit }}"

- name: Install Task
uses: go-task/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1.0.0
Expand Down Expand Up @@ -110,6 +133,7 @@ jobs:
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- name: Docker metadata
Expand All @@ -122,6 +146,26 @@ jobs:
type=edge
type=ref,event=pr

- name: Cache Go build mounts
id: cache
uses: actions/cache@v4
with:
path: .buildkit-cache
key: buildkit-${{ runner.os }}-${{ hashFiles('Dockerfile', 'go.sum') }}
restore-keys: |
buildkit-${{ runner.os }}-

- name: Inject Go caches into builder
uses: reproducible-containers/buildkit-cache-dance@v3
with:
builder: ${{ steps.buildx.outputs.name }}
cache-map: |
{
".buildkit-cache/go-mod": "/go/pkg/mod",
".buildkit-cache/go-build": "/root/.cache/go-build"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build and push image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
Expand All @@ -135,3 +179,5 @@ jobs:
build-args: |
GIT_TAG=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}
cache-from: type=gha,scope=cagent-image
cache-to: type=gha,mode=max,scope=cagent-image