| |
@@ -0,0 +1,102 @@ |
|
1 |
+# ============================================================================== |
|
2 |
+# Example: Caller workflow for test-image |
|
3 |
+# Lives in: 9it-full-service/shared-workflows/.github/workflows/build.yml |
|
4 |
+# |
|
5 |
+# This shows how to use the shared workflows with a dynamic architecture matrix. |
|
6 |
+# Adjust the matrix.include array to control which architectures are built. |
|
7 |
+# ============================================================================== |
|
8 |
+ |
|
9 |
+name: Build Image |
|
10 |
+ |
|
11 |
+on: |
|
12 |
+ workflow_dispatch: |
|
13 |
+ inputs: |
|
14 |
+ version: |
|
15 |
+ description: 'Version tag for the image' |
|
16 |
+ required: false |
|
17 |
+ default: 'dev' |
|
18 |
+ type: string |
|
19 |
+ # push: |
|
20 |
+ # branches: |
|
21 |
+ # - main |
|
22 |
+ # - develop |
|
23 |
+ # - 'release/*' |
|
24 |
+ # paths: |
|
25 |
+ # - 'operator/**' |
|
26 |
+ # - 'src/**' |
|
27 |
+ # - 'go.mod' |
|
28 |
+ # - 'go.sum' |
|
29 |
+ # - 'main.go' |
|
30 |
+ # - 'Dockerfile' |
|
31 |
+ |
|
32 |
+jobs: |
|
33 |
+ # ============================================================================ |
|
34 |
+ # 1. Prepare - Get version info |
|
35 |
+ # ============================================================================ |
|
36 |
+ prepare: |
|
37 |
+ uses: 9it-full-service/shared-workflows/.github/workflows/prepare.yml@main |
|
38 |
+ with: |
|
39 |
+ version_override: ${{ github.event.inputs.version || '' }} |
|
40 |
+ default_version: 'dev' |
|
41 |
+ |
|
42 |
+ # ============================================================================ |
|
43 |
+ # 2. Build - Matrix over architectures |
|
44 |
+ # |
|
45 |
+ # ⚡ This is where the magic happens: |
|
46 |
+ # - Add/remove entries from matrix.include to control which archs are built |
|
47 |
+ # - Each project defines its own runner labels and builder images |
|
48 |
+ # - needs_qemu: true triggers QEMU setup for cross-compilation |
|
49 |
+ # ============================================================================ |
|
50 |
+ build: |
|
51 |
+ needs: [prepare] |
|
52 |
+ strategy: |
|
53 |
+ fail-fast: false |
|
54 |
+ matrix: |
|
55 |
+ include: |
|
56 |
+ # ── ARM64 (native) ── |
|
57 |
+ - arch: arm64 |
|
58 |
+ runner: arc-runner-set |
|
59 |
+ needs_qemu: false |
|
60 |
+ build_args: "" |
|
61 |
+ |
|
62 |
+ # ── ARMv7 (cross-compiled via QEMU on amd64) ── |
|
63 |
+ # - arch: armv7 |
|
64 |
+ # runner: arc-runner-set |
|
65 |
+ # needs_qemu: false |
|
66 |
+ # build_args: | |
|
67 |
+ # # GO_BUILDER_IMAGE=ghcr.io/mogenius/go-builder:latest-amd64 |
|
68 |
+ # # RUST_BUILDER_IMAGE=ghcr.io/mogenius/rust-builder:latest-amd64 |
|
69 |
+ # # BPFTOOL_IMAGE=ghcr.io/mogenius/bpftool:latest-armv7 |
|
70 |
+ # # SNOOPY_IMAGE=ghcr.io/mogenius/snoopy:latest-armv7 |
|
71 |
+ # # RUNTIME_IMAGE=ghcr.io/mogenius/runtime:latest-armv7 |
|
72 |
+ |
|
73 |
+ uses: 9it-full-service/shared-workflows/.github/workflows/build-image.yml@main |
|
74 |
+ with: |
|
75 |
+ image_name: ghcr.io/9it-full-service/quilldrop |
|
76 |
+ dockerfile: ./Dockerfile-images |
|
77 |
+ context: . |
|
78 |
+ arch: ${{ matrix.arch }} |
|
79 |
+ runner: ${{ matrix.runner }} |
|
80 |
+ needs_qemu: ${{ matrix.needs_qemu }} |
|
81 |
+ version: ${{ needs.prepare.outputs.version }}-images |
|
82 |
+ commit_hash: ${{ needs.prepare.outputs.commit_hash }} |
|
83 |
+ git_branch: ${{ needs.prepare.outputs.git_branch }} |
|
84 |
+ build_timestamp: ${{ needs.prepare.outputs.build_timestamp }} |
|
85 |
+ build_args: ${{ matrix.build_args }} |
|
86 |
+ |
|
87 |
+ # ============================================================================ |
|
88 |
+ # 3. Manifest - Combine all arch images into one multi-arch manifest |
|
89 |
+ # |
|
90 |
+ # The architectures array MUST match the archs built above. |
|
91 |
+ # ============================================================================ |
|
92 |
+ manifest: |
|
93 |
+ needs: [build] |
|
94 |
+ uses: 9it-full-service/shared-workflows/.github/workflows/create-manifest.yml@main |
|
95 |
+ with: |
|
96 |
+ image_name: ghcr.io/9it-full-service/quilldrop |
|
97 |
+ version: ${{ needs.prepare.outputs.version }}-images |
|
98 |
+ architectures: '["arm64"]' |
|
99 |
+ tag_latest: ${{ github.ref_name == 'main' && needs.prepare.outputs.is_release == 'true' }} |
|
100 |
+ tag_sha: true |
|
101 |
+ tag_branch: true |
|
102 |
+ runner: arc-runner-set |