mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
332 lines
11 KiB
YAML
332 lines
11 KiB
YAML
name: Update CI docker image
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/update_docker_ci.yml
|
|
|
|
- ".github/actions/build_docker_image/**"
|
|
|
|
- "docker/ci/**"
|
|
- "docker/compilers/**"
|
|
- "docker/tools/**"
|
|
push:
|
|
branches: [develop]
|
|
paths:
|
|
- .github/workflows/update_docker_ci.yml
|
|
|
|
- ".github/actions/build_docker_image/**"
|
|
|
|
- "docker/ci/**"
|
|
- "docker/compilers/**"
|
|
- "docker/tools/**"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
# Only matches runs for the current workflow - matches against branch & tags
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
# We want to execute all builds sequentially in develop
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CLANG_MAJOR_VERSION: 19
|
|
GCC_MAJOR_VERSION: 12
|
|
GCC_VERSION: 12.3.0
|
|
|
|
jobs:
|
|
repo:
|
|
name: Calculate repo name
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
GHCR_REPO: ${{ steps.set-ghcr-repo.outputs.GHCR_REPO }}
|
|
|
|
steps:
|
|
- name: Set GHCR_REPO
|
|
id: set-ghcr-repo
|
|
run: |
|
|
echo "GHCR_REPO=$(echo ghcr.io/${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_OUTPUT}
|
|
|
|
gcc-amd64:
|
|
name: Build and push GCC docker image (amd64)
|
|
runs-on: heavy
|
|
needs: repo
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
|
|
with:
|
|
files: "docker/compilers/gcc/**"
|
|
|
|
- uses: ./.github/actions/build_docker_image
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }}
|
|
with:
|
|
images: |
|
|
${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc
|
|
rippleci/clio_gcc
|
|
push_image: ${{ github.event_name != 'pull_request' }}
|
|
directory: docker/compilers/gcc
|
|
tags: |
|
|
type=raw,value=amd64-latest
|
|
type=raw,value=amd64-${{ env.GCC_MAJOR_VERSION }}
|
|
type=raw,value=amd64-${{ env.GCC_VERSION }}
|
|
type=raw,value=amd64-${{ github.sha }}
|
|
platforms: linux/amd64
|
|
build_args: |
|
|
GCC_MAJOR_VERSION=${{ env.GCC_MAJOR_VERSION }}
|
|
GCC_VERSION=${{ env.GCC_VERSION }}
|
|
dockerhub_repo: rippleci/clio_gcc
|
|
dockerhub_description: GCC compiler for XRPLF/clio.
|
|
|
|
gcc-arm64:
|
|
name: Build and push GCC docker image (arm64)
|
|
runs-on: heavy-arm64
|
|
needs: repo
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
|
|
with:
|
|
files: "docker/compilers/gcc/**"
|
|
|
|
- uses: ./.github/actions/build_docker_image
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }}
|
|
with:
|
|
images: |
|
|
${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc
|
|
rippleci/clio_gcc
|
|
push_image: ${{ github.event_name != 'pull_request' }}
|
|
directory: docker/compilers/gcc
|
|
tags: |
|
|
type=raw,value=arm64-latest
|
|
type=raw,value=arm64-${{ env.GCC_MAJOR_VERSION }}
|
|
type=raw,value=arm64-${{ env.GCC_VERSION }}
|
|
type=raw,value=arm64-${{ github.sha }}
|
|
platforms: linux/arm64
|
|
build_args: |
|
|
GCC_MAJOR_VERSION=${{ env.GCC_MAJOR_VERSION }}
|
|
GCC_VERSION=${{ env.GCC_VERSION }}
|
|
dockerhub_repo: rippleci/clio_gcc
|
|
dockerhub_description: GCC compiler for XRPLF/clio.
|
|
|
|
gcc-merge:
|
|
name: Merge and push multi-arch GCC docker image
|
|
runs-on: heavy
|
|
needs: [repo, gcc-amd64, gcc-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/compilers/gcc/**"
|
|
|
|
- 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: Login to DockerHub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
password: ${{ secrets.DOCKERHUB_PW }}
|
|
|
|
- name: Create and push multi-arch manifest
|
|
if: github.event_name != 'pull_request' && steps.changed-files.outputs.any_changed == 'true'
|
|
run: |
|
|
for image in ${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc rippleci/clio_gcc; do
|
|
docker buildx imagetools create \
|
|
-t $image:latest \
|
|
-t $image:${{ env.GCC_MAJOR_VERSION }} \
|
|
-t $image:${{ env.GCC_VERSION }} \
|
|
-t $image:${{ github.sha }} \
|
|
$image:arm64-latest \
|
|
$image:amd64-latest
|
|
done
|
|
|
|
clang:
|
|
name: Build and push Clang docker image
|
|
runs-on: heavy
|
|
needs: repo
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
|
|
with:
|
|
files: "docker/compilers/clang/**"
|
|
|
|
- uses: ./.github/actions/build_docker_image
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }}
|
|
with:
|
|
images: |
|
|
${{ needs.repo.outputs.GHCR_REPO }}/clio-clang
|
|
rippleci/clio_clang
|
|
push_image: ${{ github.event_name != 'pull_request' }}
|
|
directory: docker/compilers/clang
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=raw,value=${{ env.CLANG_MAJOR_VERSION }}
|
|
type=raw,value=${{ github.sha }}
|
|
platforms: linux/amd64,linux/arm64
|
|
build_args: |
|
|
CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }}
|
|
dockerhub_repo: rippleci/clio_clang
|
|
dockerhub_description: Clang compiler for XRPLF/clio.
|
|
|
|
tools-amd64:
|
|
name: Build and push tools docker image (amd64)
|
|
runs-on: heavy
|
|
needs: [repo, 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: |
|
|
${{ needs.repo.outputs.GHCR_REPO }}/clio-tools
|
|
push_image: ${{ github.event_name != 'pull_request' }}
|
|
directory: docker/tools
|
|
tags: |
|
|
type=raw,value=amd64-latest
|
|
type=raw,value=amd64-${{ github.sha }}
|
|
platforms: linux/amd64
|
|
build_args: |
|
|
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
|
|
GCC_VERSION=${{ env.GCC_VERSION }}
|
|
|
|
tools-arm64:
|
|
name: Build and push tools docker image (arm64)
|
|
runs-on: heavy-arm64
|
|
needs: [repo, 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: |
|
|
${{ needs.repo.outputs.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: |
|
|
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
|
|
GCC_VERSION=${{ env.GCC_VERSION }}
|
|
|
|
tools-merge:
|
|
name: Merge and push multi-arch tools docker image
|
|
runs-on: heavy
|
|
needs: [repo, 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: Create and push multi-arch manifest
|
|
if: github.event_name != 'pull_request' && steps.changed-files.outputs.any_changed == 'true'
|
|
run: |
|
|
image=${{ needs.repo.outputs.GHCR_REPO }}/clio-tools
|
|
docker buildx imagetools create \
|
|
-t $image:latest \
|
|
-t $image:${{ github.sha }} \
|
|
$image:arm64-latest \
|
|
$image:amd64-latest
|
|
|
|
ci:
|
|
name: Build and push CI docker image
|
|
runs-on: heavy
|
|
needs: [repo, gcc-merge, clang, tools-merge]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/build_docker_image
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }}
|
|
with:
|
|
images: |
|
|
${{ needs.repo.outputs.GHCR_REPO }}/clio-ci
|
|
rippleci/clio_ci
|
|
push_image: ${{ github.event_name != 'pull_request' }}
|
|
directory: docker/ci
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=raw,value=gcc_${{ env.GCC_MAJOR_VERSION }}_clang_${{ env.CLANG_MAJOR_VERSION }}
|
|
type=raw,value=${{ github.sha }}
|
|
platforms: linux/amd64,linux/arm64
|
|
build_args: |
|
|
GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
|
|
CLANG_MAJOR_VERSION=${{ env.CLANG_MAJOR_VERSION }}
|
|
GCC_VERSION=${{ env.GCC_VERSION }}
|
|
dockerhub_repo: rippleci/clio_ci
|
|
dockerhub_description: CI image for XRPLF/clio.
|