From fbd5238c956d70e3cf869600a2a9080baa7837d9 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Wed, 25 Sep 2024 14:02:35 -0400 Subject: [PATCH 1/3] [libc++] Add a Github action to build libc++'s Docker images This patch adds a Github action that runs whenever changes to the libc++ Docker images are pushed to `main`. The action will rebuild the Docker images and push them to LLVM's container registry so that we can then point to those images from our CI nodes. --- .../workflows/libcxx-build-containers.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/libcxx-build-containers.yaml diff --git a/.github/workflows/libcxx-build-containers.yaml b/.github/workflows/libcxx-build-containers.yaml new file mode 100644 index 0000000000000..e4ff2141f1357 --- /dev/null +++ b/.github/workflows/libcxx-build-containers.yaml @@ -0,0 +1,51 @@ +# This file defines an action that builds the various Docker images used to run +# libc++ CI whenever modifications to those Docker files are pushed to `main`. +# +# The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages +# and tagged appropriately. The selection of which Docker image version is used by the libc++ +# CI nodes at any given point is controlled by the libc++ maintainers using a mechanism that +# is not publicly visible for safety purposes. + +name: Build Docker images for libc++ CI + +permissions: + contents: read + packages: write + +on: + push: + branches: + - main + paths: + - 'libcxx/utils/ci/**' + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: github.repository_owner == 'llvm' + + steps: + - uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push the Linux builder image + working-directory: libcxx/utils/ci + run: + - docker compose build actions-builder + - docker compose push actions-builder + env: + TAG: libcxx-linux-builder:${{ github.sha }} + + - name: Build and push the Android builder image + working-directory: libcxx/utils/ci + run: + - docker compose build android-buildkite-builder + - docker compose push android-buildkite-builder + env: + TAG: libcxx-android-builder:${{ github.sha }} From 45482ba63c1a9183c478f1b7fba0ca0497877638 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 15 Nov 2024 08:31:37 +0100 Subject: [PATCH 2/3] Address review comments and update after docker-in-docker changes --- .github/workflows/libcxx-build-containers.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/libcxx-build-containers.yaml b/.github/workflows/libcxx-build-containers.yaml index e4ff2141f1357..c2f83e707b6fa 100644 --- a/.github/workflows/libcxx-build-containers.yaml +++ b/.github/workflows/libcxx-build-containers.yaml @@ -3,8 +3,7 @@ # # The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages # and tagged appropriately. The selection of which Docker image version is used by the libc++ -# CI nodes at any given point is controlled by the libc++ maintainers using a mechanism that -# is not publicly visible for safety purposes. +# CI nodes at any given point is controlled from the workflow files themselves. name: Build Docker images for libc++ CI @@ -27,6 +26,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Build the Linux builder image and the Android builder image + working-directory: libcxx/utils/ci + run: + - docker compose build actions-builder + - docker compose build android-buildkite-builder + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: @@ -34,18 +39,16 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push the Linux builder image + - name: Push the Linux builder image working-directory: libcxx/utils/ci run: - - docker compose build actions-builder - docker compose push actions-builder env: TAG: libcxx-linux-builder:${{ github.sha }} - - name: Build and push the Android builder image + - name: Push the Android builder image working-directory: libcxx/utils/ci run: - - docker compose build android-buildkite-builder - docker compose push android-buildkite-builder env: TAG: libcxx-android-builder:${{ github.sha }} From 85314e951c05ef8a84c0e17370ffab63a130e27d Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 15 Nov 2024 08:35:32 +0100 Subject: [PATCH 3/3] Also trigger the action on PRs, but don't push --- ...build-containers.yaml => libcxx-build-containers.yml} | 9 +++++++++ 1 file changed, 9 insertions(+) rename .github/workflows/{libcxx-build-containers.yaml => libcxx-build-containers.yml} (85%) diff --git a/.github/workflows/libcxx-build-containers.yaml b/.github/workflows/libcxx-build-containers.yml similarity index 85% rename from .github/workflows/libcxx-build-containers.yaml rename to .github/workflows/libcxx-build-containers.yml index c2f83e707b6fa..e55a4f2a11b09 100644 --- a/.github/workflows/libcxx-build-containers.yaml +++ b/.github/workflows/libcxx-build-containers.yml @@ -17,6 +17,13 @@ on: - main paths: - 'libcxx/utils/ci/**' + - '.github/workflows/libcxx-build-containers.yml' + pull_request: + branches: + - main + paths: + - 'libcxx/utils/ci/**' + - '.github/workflows/libcxx-build-containers.yml' jobs: build-and-push: @@ -40,6 +47,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push the Linux builder image + if: github.event_name == 'push' working-directory: libcxx/utils/ci run: - docker compose push actions-builder @@ -47,6 +55,7 @@ jobs: TAG: libcxx-linux-builder:${{ github.sha }} - name: Push the Android builder image + if: github.event_name == 'push' working-directory: libcxx/utils/ci run: - docker compose push android-buildkite-builder