Skip to content

Commit 0225b9a

Browse files
committed
ci(nightly): Split nightly tests and build when push to main
We should separate the nightly tests from the push-to-main build. Ideally, when we push to main, we have checked that everything is as expected and we should just upload the binaries to be fetched by users (if they want to try the latest main for instance). For now, we use github packages. Nightly tests should eventually fork into smoke tests (run a tight loop of all tests we have for many iterations, once every week) and pure nightly tests that run every test we have every day/two days etc. Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
1 parent c67e833 commit 0225b9a

4 files changed

Lines changed: 192 additions & 2 deletions

File tree

.github/workflows/ci_main.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build & Upload
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
pull-requests: read
15+
packages: write
16+
id-token: write
17+
attestations: write
18+
19+
jobs:
20+
build:
21+
name: Build
22+
uses: ./.github/workflows/build.yml
23+
with:
24+
ref: ${{ github.sha }}
25+
go_version: "1.24.6"
26+
27+
upload:
28+
name: Upload
29+
needs: build
30+
uses: ./.github/workflows/upload_s3.yml
31+
with:
32+
ref: ${{ github.sha }}
33+
secrets:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+

.github/workflows/ci_nightly.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: urunc CI (nightly)
22

33
on:
4-
push:
5-
branches: ["main"]
64
workflow_dispatch:
75
schedule:
86
- cron: '0 0 * * *'
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Upload to S3
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
required: true
8+
type: string
9+
default: ''
10+
secrets:
11+
GITHUB_TOKEN:
12+
required: true
13+
14+
workflow_dispatch:
15+
inputs:
16+
ref:
17+
required: true
18+
type: string
19+
default: ''
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
build:
26+
runs-on: ${{ matrix.runner }}
27+
strategy:
28+
matrix:
29+
include:
30+
- arch: amd64
31+
runner: ubuntu-22.04
32+
- arch: arm64
33+
runner: ubuntu-22.04-arm
34+
continue-on-error: true
35+
36+
steps:
37+
- name: Harden the runner (Audit all outbound calls)
38+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
39+
with:
40+
egress-policy: audit
41+
42+
- name: Get revision SHA and branch (safe)
43+
id: get-rev
44+
env:
45+
EVENT_NAME: ${{ github.event_name }}
46+
IS_MERGED: ${{ github.event.pull_request.merged }}
47+
GITHUB_SHA: ${{ github.sha }}
48+
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
49+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
50+
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
51+
REF_NAME: ${{ github.ref_name }}
52+
run: |
53+
if [ "$EVENT_NAME" == "pull_request" ]; then
54+
if [ "$IS_MERGED" == "true" ]; then
55+
sha="$GITHUB_SHA"
56+
branch="$PR_BASE_REF"
57+
echo "PR merged. SHA: ${sha}, Branch: ${branch}"
58+
else
59+
sha="$PR_HEAD_SHA"
60+
branch="$PR_HEAD_REF"
61+
echo "PR not yet merged. SHA: ${sha}, Branch: ${branch}"
62+
fi
63+
else
64+
sha="$GITHUB_SHA"
65+
branch="$REF_NAME"
66+
echo "$EVENT_NAME event. SHA: ${sha}, Branch: ${branch}"
67+
fi
68+
69+
echo "sha=${sha}" >> "$GITHUB_ENV"
70+
echo "branch=${branch}" >> "$GITHUB_ENV"
71+
72+
- name: Download urunc artifact
73+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
74+
with:
75+
name: urunc_${{ matrix.arch }}-${{ github.run_id }}
76+
path: ./
77+
78+
- name: Download containerd-shim-urunc-v2 artifact
79+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
80+
with:
81+
name: containerd-shim-urunc-v2_${{ matrix.arch }}-${{ github.run_id }}
82+
path: ./
83+
84+
- name: Upload urunc to GitHub Packages
85+
id: upload-urunc
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
REPO: ${{ github.repository }}
89+
ARCH: ${{ matrix.arch }}
90+
VERSION: ${{ env.branch }}
91+
run: |
92+
PACKAGE_NAME="urunc"
93+
FILE="urunc_static_${ARCH}"
94+
UPLOAD_URL="https://uploads.github.com/repos/${REPO}/packages/generic/${PACKAGE_NAME}/${VERSION}/${ARCH}/${FILE}"
95+
DOWNLOAD_URL="https://github.com/${REPO}/packages/${PACKAGE_NAME}/${VERSION}/${ARCH}/${FILE}"
96+
97+
echo "Uploading ${FILE} → ${UPLOAD_URL}"
98+
curl -sSL -X PUT \
99+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
100+
-H "Content-Type: application/octet-stream" \
101+
--data-binary @"${FILE}" \
102+
"${UPLOAD_URL}"
103+
104+
echo "urunc_url=${DOWNLOAD_URL}" >> "$GITHUB_OUTPUT"
105+
106+
- name: Upload containerd-shim-urunc-v2 to GitHub Packages
107+
id: upload-shim
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
REPO: ${{ github.repository }}
111+
ARCH: ${{ matrix.arch }}
112+
VERSION: ${{ env.branch }}
113+
run: |
114+
PACKAGE_NAME="containerd-shim-urunc-v2"
115+
FILE="containerd-shim-urunc-v2_static_${ARCH}"
116+
UPLOAD_URL="https://uploads.github.com/repos/${REPO}/packages/generic/${PACKAGE_NAME}/${VERSION}/${ARCH}/${FILE}"
117+
DOWNLOAD_URL="https://github.com/${REPO}/packages/${PACKAGE_NAME}/${VERSION}/${ARCH}/${FILE}"
118+
119+
echo "Uploading ${FILE} → ${UPLOAD_URL}"
120+
curl -sSL -X PUT \
121+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
122+
-H "Content-Type: application/octet-stream" \
123+
--data-binary @"${FILE}" \
124+
"${UPLOAD_URL}"
125+
126+
echo "shim_url=${DOWNLOAD_URL}" >> "$GITHUB_OUTPUT"
127+
128+
- name: Print download URLs
129+
run: |
130+
echo "Uploaded urunc binary:"
131+
echo "${{ steps.upload-urunc.outputs.urunc_url }}"
132+
echo ""
133+
echo "Uploaded containerd-shim-urunc-v2 binary:"
134+
echo "${{ steps.upload-shim.outputs.shim_url }}"
135+
136+

docs/installation.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,27 @@ chmod +x $CONTAINERD_BINARY_FILENAME
359359
sudo mv $CONTAINERD_BINARY_FILENAME /usr/local/bin/containerd-shim-urunc-v2
360360
```
361361

362+
### Option 3: Install from latest artifacts (tip of the main branch)
363+
364+
We can also install `urunc` from binary builds of the main branch:
365+
366+
```bash
367+
URUNC_VERSION=main
368+
URUNC_BINARY_FILENAME="urunc_static_$(dpkg --print-architecture)"
369+
wget -q https://github.com/urunc-dev/packages/urunc/$URUNC_VERSION/$(dpkg --print-architecture)/$URUNC_BINARY_FILENAME
370+
chmod +x $URUNC_BINARY_FILENAME
371+
sudo mv $URUNC_BINARY_FILENAME /usr/local/bin/urunc
372+
```
373+
374+
And for `containerd-shim-urunc-v2`:
375+
376+
```bash
377+
CONTAINERD_BINARY_FILENAME="containerd-shim-urunc-v2_static_$(dpkg --print-architecture)"
378+
wget -q https://github.com/urunc-dev/packages/urunc/$URUNC_VERSION/$(dpkg --print-architecture)/$CONTAINERD_BINARY_FILENAME
379+
chmod +x $CONTAINERD_BINARY_FILENAME
380+
sudo mv $CONTAINERD_BINARY_FILENAME /usr/local/bin/containerd-shim-urunc-v2
381+
```
382+
362383
### Add urunc runtime to containerd
363384

364385
We also need to add `urunc` as a runtime in containerd's configuration:

0 commit comments

Comments
 (0)