Skip to content

Commit d02911e

Browse files
committed
ci: unify PR workflows and fix multi-arch image push
Merge test.yaml and test_image.yaml into pull-request-ci.yaml with sequential jobs to avoid Nix cache rate limits. Push test images tagged pr-<id> on pull requests. Fix digest file concatenation bug in both pull-request-ci and publish workflows.
1 parent 15c1a11 commit d02911e

3 files changed

Lines changed: 41 additions & 51 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
contents: read
6464
packages: write
6565
strategy:
66+
max-parallel: 1
6667
matrix:
6768
include:
6869
- arch: amd64
@@ -102,6 +103,7 @@ jobs:
102103
103104
mkdir -p /tmp/digests
104105
cp /tmp/digest /tmp/digests/${{ matrix.arch }}
106+
echo >> /tmp/digests/${{ matrix.arch }}
105107
106108
- name: Upload digest
107109
uses: actions/upload-artifact@v5
Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Test Image Build
2+
name: Pull Request CI
33

44
on:
55
pull_request:
@@ -10,13 +10,45 @@ on:
1010
workflow_dispatch:
1111

1212
concurrency:
13-
group: "test-image-${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
13+
group: "pr-ci-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
1414
cancel-in-progress: true
1515

1616
jobs:
17-
test_build:
18-
name: Test Build (${{ matrix.arch }})
17+
build-and-test:
18+
name: Build and Test
1919
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: nix develop --command bash {0}
23+
steps:
24+
- name: Check out the repo
25+
uses: actions/checkout@v5
26+
27+
- name: Install Nix
28+
# Pinned to v21 commit SHA for supply-chain safety.
29+
# To update: git ls-remote https://github.com/DeterminateSystems/nix-installer-action.git <tag>
30+
uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
31+
32+
- name: Enable Nix cache
33+
# Pinned to v13 commit SHA for supply-chain safety.
34+
# To update: git ls-remote https://github.com/DeterminateSystems/magic-nix-cache-action.git <tag>
35+
uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
36+
with:
37+
use-flakehub: false
38+
39+
- name: Build
40+
run: go build ./...
41+
42+
- name: Run Checks
43+
run: just check
44+
env:
45+
SYSDIG_MCP_API_HOST: ${{ vars.SYSDIG_MCP_API_HOST }}
46+
SYSDIG_MCP_API_TOKEN: ${{ secrets.SYSDIG_MCP_API_SECURE_TOKEN }}
47+
48+
test-image:
49+
name: Test Image (${{ matrix.arch }})
50+
runs-on: ubuntu-latest
51+
needs: [build-and-test]
2052
defaults:
2153
run:
2254
shell: nix develop --command bash {0}
@@ -85,6 +117,7 @@ jobs:
85117
86118
mkdir -p /tmp/digests
87119
cp /tmp/digest /tmp/digests/${{ matrix.arch }}
120+
echo >> /tmp/digests/${{ matrix.arch }}
88121
89122
- name: Upload digest
90123
uses: actions/upload-artifact@v5
@@ -94,10 +127,10 @@ jobs:
94127
if-no-files-found: error
95128
retention-days: 1
96129

97-
push_pr_image:
130+
push-pr-image:
98131
name: Push PR image to GitHub Packages
99132
runs-on: ubuntu-latest
100-
needs: [test_build]
133+
needs: [test-image]
101134
if: github.event_name == 'pull_request'
102135
permissions:
103136
contents: read

.github/workflows/test.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)