Skip to content

Commit 5ed644b

Browse files
committed
ci: Temp Commit
1 parent a684e44 commit 5ed644b

File tree

4 files changed

+157
-28
lines changed

4 files changed

+157
-28
lines changed

.github/workflows/build-llvm17.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,32 @@ name: Build LLVM17 base image
22

33
on:
44
workflow_dispatch: # Allows manual triggering
5+
push:
56

67
permissions:
78
packages: write
89
contents: read
910

11+
env:
12+
REGISTRY_IMAGE: ghcr.io/openvadl/llvm17-base
13+
1014
jobs:
1115
build:
12-
# The build crashed on MacOS arm64, so we only use x64 runners to build the images.
13-
# This also avoids the need of exposing the macOS user password as secret to the CI.
14-
runs-on: self-hosted-x64
15-
16-
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v4
19-
20-
- name: Log in to GitHub Container Registry
21-
uses: docker/login-action@v2
22-
with:
23-
registry: ghcr.io
24-
username: ${{ github.actor }}
25-
password: ${{ secrets.GITHUB_TOKEN }}
26-
27-
- name: Set up QEMU
28-
uses: docker/setup-qemu-action@v3
29-
30-
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v3
32-
33-
- name: Build and push
34-
uses: docker/build-push-action@v6
35-
with:
36-
context: vadl/test/resources/images/llvm_riscv/llvm17_base_image
37-
platforms: linux/amd64,linux/arm64
38-
push: true
39-
tags: ghcr.io/openvadl/llvm17-base:latest
16+
uses: ./.github/workflows/reusable-image-build.yml
17+
strategy:
18+
matrix:
19+
target:
20+
- platform: linux/arm64
21+
runner: self-hosted-arm64
22+
- platform: linux/amd64
23+
runner: self-hosted-x64
24+
with:
25+
image: ${{ env.REGISTRY_IMAGE }}
26+
context: vadl/test/resources/images/llvm_riscv/llvm17_base_image
27+
platform: ${{ matrix.target.platform }}
28+
runner: ${{ matrix.target.runner }}
29+
30+
merge:
31+
uses: ./.github/workflows/reusable-image-merge.yml
32+
with:
33+
image: ${{ env.REGISTRY_IMAGE }}

.github/workflows/build-riscv-toolchain.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77
packages: write
88
contents: read
99

10+
1011
jobs:
1112
build:
1213
# The build crashed on MacOS arm64, so we only use x64 runners to build the images.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Reusable Image Build Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image:
7+
description: 'The image name'
8+
required: true
9+
type: string
10+
platform:
11+
description: 'The docker build platform'
12+
required: true
13+
type: string
14+
runner:
15+
description: 'Runs-on property'
16+
required: true
17+
type: string
18+
context:
19+
description: 'Path to context'
20+
required: true
21+
type: string
22+
23+
jobs:
24+
build-and-push:
25+
name: ${{ inputs.platform }}
26+
runs-on: ${{ inputs.runner }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Prepare
31+
run: |
32+
platform=${{ inputs.platform }}
33+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
34+
35+
- name: Docker meta
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ inputs.image }}
40+
41+
- name: Unlock Keychain
42+
if: ${{ runner.os == 'macOS' }}
43+
env:
44+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
45+
run: |
46+
security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" ~/Library/Keychains/login.keychain-db
47+
48+
- name: Log in to GitHub Container Registry
49+
uses: docker/login-action@v2
50+
with:
51+
registry: ghcr.io
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Build and push
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: ${{ input.context }}
59+
platforms: ${{ inputs.platform }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
tags: ${{ inputs.image }}
62+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
63+
64+
- name: Export digest
65+
run: |
66+
mkdir -p ${{ runner.temp }}/digests
67+
digest="${{ steps.build.outputs.digest }}"
68+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
69+
70+
- name: Upload digest
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: digests-${{ env.PLATFORM_PAIR }}
74+
path: ${{ runner.temp }}/digests/*
75+
if-no-files-found: error
76+
retention-days: 1
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Reusable Image Merge Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image:
7+
description: 'The name of the image'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
merge:
13+
runs-on: self-hosted
14+
steps:
15+
- name: Download digests
16+
uses: actions/download-artifact@v4
17+
with:
18+
path: ${{ runner.temp }}/digests
19+
pattern: digests-*
20+
merge-multiple: true
21+
22+
- name: Unlock Keychain
23+
if: ${{ runner.os == 'macOS' }}
24+
env:
25+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
26+
run: |
27+
security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" ~/Library/Keychains/login.keychain-db
28+
29+
- name: Log in to GitHub Container Registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Docker meta
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ inputs.image }}
44+
tags: |
45+
type=ref,event=branch
46+
type=ref,event=pr
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
50+
- name: Create manifest list and push
51+
working-directory: ${{ runner.temp }}/digests
52+
run: |
53+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
54+
$(printf '${{ inputs.image }}@sha256:%s ' *)
55+
56+
- name: Inspect image
57+
run: |
58+
docker buildx imagetools inspect ${{ inputs.image }}:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)