-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (190 loc) · 6.8 KB
/
Copy pathbuild.yaml
File metadata and controls
211 lines (190 loc) · 6.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: criu-static build
on:
# Run on push events
push:
# Only run when code is pushed to these branches
branches:
- "master"
# Avoid running when tags are pushed
tags-ignore:
- "**"
# Avoid running when certain files are modified
paths-ignore:
- "docs/**"
# Run on pull request events
pull_request:
types:
- opened
- synchronize
- reopened
# Manual trigger for custom builds and releases
workflow_dispatch:
inputs:
criu_version:
description: 'CRIU version to build (e.g., 4.1)'
required: false
type: string
criu_commit:
description: 'CRIU commit/tag to build (overrides version if set)'
required: false
type: string
criu_shasum:
description: 'SHA256 checksum for the CRIU source'
required: true
type: string
build_revision:
description: 'Build revision suffix (e.g., r1, r2) for build script changes'
required: false
type: string
release_type:
description: 'Release type'
required: false
type: choice
default: 'draft'
options:
- 'draft'
- 'release'
# avoid running multiple copies of the same workflow in parallel
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-amd64:
name: Build criu(amd64)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build criu
if: github.event_name != 'workflow_dispatch'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
outputs: type=local,dest=./output
file: Dockerfile
push: false
load: true
tags: "criu-build-image-amd64"
platforms: "linux/amd64"
cache-from: type=gha,scope=criu-build-image-amd64
cache-to: type=gha,mode=max,scope=criu-build-image-amd64
- name: Build criu
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
outputs: type=local,dest=./output
file: Dockerfile
push: false
load: true
tags: "criu-build-image-amd64"
platforms: "linux/amd64"
cache-from: type=gha,scope=criu-build-image-amd64
cache-to: type=gha,mode=max,scope=criu-build-image-amd64
build-args: |
CRIU_VERSION=${{ inputs.criu_version }}
CRIU_COMMIT=${{ inputs.criu_commit }}
CRIU_SHASUM=${{ inputs.criu_shasum }}
BUILD_REVISION=${{ inputs.build_revision }}
- name: Upload amd64 artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: criu-amd64
path: ./output
build-arm64:
name: Build criu(arm64)
runs-on: ubuntu-24.04-arm64
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build criu
if: github.event_name != 'workflow_dispatch'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
outputs: type=local,dest=./output
file: Dockerfile
push: false
load: true
tags: "criu-build-image-arm64"
platforms: "linux/arm64"
cache-from: type=gha,scope=criu-build-image-arm64
cache-to: type=gha,mode=max,scope=criu-build-image-arm64
- name: Build criu
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
outputs: type=local,dest=./output
file: Dockerfile
push: false
load: true
tags: "criu-build-image-arm64"
platforms: "linux/arm64"
cache-from: type=gha,scope=criu-build-image-arm64
cache-to: type=gha,mode=max,scope=criu-build-image-arm64
build-args: |
CRIU_VERSION=${{ inputs.criu_version }}
CRIU_COMMIT=${{ inputs.criu_commit }}
CRIU_SHASUM=${{ inputs.criu_shasum }}
BUILD_REVISION=${{ inputs.build_revision }}
- name: Upload arm64 artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: criu-arm64
path: ./output
release:
name: Release
if: "github.event_name == 'workflow_dispatch'"
needs: [build-amd64, build-arm64]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Download build artifacts (amd64)
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: criu-amd64
path: dist
- name: Download build artifacts (arm64)
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: criu-arm64
path: dist
- name: Setup Java for JReleaser
uses: actions/setup-java@b6e674f4b717d7b0ae3baee0fbe79f498905dfde # v1.4.4
with:
java-version: 11
- name: Determine version
id: version
run: |
if [ -n "${{ inputs.criu_commit }}" ]; then
BASE_VERSION="${{ inputs.criu_commit }}"
elif [ -n "${{ inputs.criu_version }}" ]; then
BASE_VERSION="${{ inputs.criu_version }}"
else
BASE_VERSION=$(cmake --preset static-release -LA | grep CRIU_VERSION | cut -d'=' -f2)
fi
if [ -n "${{ inputs.build_revision }}" ]; then
VERSION="${BASE_VERSION}-${{ inputs.build_revision }}"
else
VERSION="${BASE_VERSION}"
fi
echo "VERSION = $VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Run JReleaser
uses: jreleaser/release-action@90ac653bb9c79d11179e65d81499f3f34527dcd5 # 2.5.0
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.VERSION }}
JRELEASER_DRAFT: ${{ inputs.release_type == 'draft' }}