ci: Build tools image separately for different archs (#2302)

This commit is contained in:
Ayaz Salikhov
2025-07-08 17:59:52 +01:00
committed by GitHub
parent ae4f2d9023
commit 12640de22d
2 changed files with 77 additions and 6 deletions

View File

@@ -194,8 +194,8 @@ jobs:
dockerhub_repo: rippleci/clio_clang dockerhub_repo: rippleci/clio_clang
dockerhub_description: Clang compiler for XRPLF/clio. dockerhub_description: Clang compiler for XRPLF/clio.
tools: tools-amd64:
name: Build and push tools docker image name: Build and push tools docker image (amd64)
runs-on: heavy runs-on: heavy
needs: [gcc-merge] needs: [gcc-merge]
@@ -218,16 +218,85 @@ jobs:
push_image: ${{ github.event_name != 'pull_request' }} push_image: ${{ github.event_name != 'pull_request' }}
directory: docker/tools directory: docker/tools
tags: | tags: |
type=raw,value=latest type=raw,value=amd64-latest
type=raw,value=${{ github.sha }} type=raw,value=amd64-${{ github.sha }}
platforms: linux/amd64,linux/arm64 platforms: linux/amd64
build_args: | build_args: |
GCC_VERSION=${{ env.GCC_VERSION }} GCC_VERSION=${{ env.GCC_VERSION }}
tools-arm64:
name: Build and push tools docker image (arm64)
runs-on: heavy-arm64
needs: [gcc-merge]
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
with:
files: "docker/tools/**"
- uses: ./.github/actions/build_docker_image
if: steps.changed-files.outputs.any_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
images: |
${{ env.GHCR_REPO }}/clio-tools
push_image: ${{ github.event_name != 'pull_request' }}
directory: docker/tools
tags: |
type=raw,value=arm64-latest
type=raw,value=arm64-${{ github.sha }}
platforms: linux/arm64
build_args: |
GCC_VERSION=${{ env.GCC_VERSION }}
tools-merge:
name: Merge and push multi-arch tools docker image
runs-on: heavy
needs: [tools-amd64, tools-arm64]
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
with:
files: "docker/tools/**"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make GHCR_REPO lowercase
run: |
echo "GHCR_REPO_LC=$(echo ${{env.GHCR_REPO}} | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV}
- name: Create and push multi-arch manifest
if: github.event_name != 'pull_request' && steps.changed-files.outputs.any_changed == 'true'
run: |
image=${{ env.GHCR_REPO_LC }}/clio-tools
docker buildx imagetools create \
-t $image:latest \
-t $image:${{ github.sha }} \
$image:arm64-latest \
$image:amd64-latest
ci: ci:
name: Build and push CI docker image name: Build and push CI docker image
runs-on: heavy runs-on: heavy
needs: [gcc-merge, clang, tools] needs: [gcc-merge, clang, tools-merge]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -82,6 +82,8 @@ RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
&& update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100 && update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100
COPY --from=clio-tools \ COPY --from=clio-tools \
/usr/local/bin/mold \
/usr/local/bin/ld.mold \
/usr/local/bin/ccache \ /usr/local/bin/ccache \
/usr/local/bin/doxygen \ /usr/local/bin/doxygen \
/usr/local/bin/ClangBuildAnalyzer \ /usr/local/bin/ClangBuildAnalyzer \