xref: /llvm-project/.github/workflows/libcxx-build-containers.yml (revision 0fd6f684b9c84c32d6cbfd9742402e788b2879f1)
1# This file defines an action that builds the various Docker images used to run
2# libc++ CI whenever modifications to those Docker files are pushed to `main`.
3#
4# The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages
5# and tagged appropriately. The selection of which Docker image version is used by the libc++
6# CI nodes at any given point is controlled from the workflow files themselves.
7
8name: Build Docker images for libc++ CI
9
10permissions:
11  contents: read
12  packages: write
13
14on:
15  push:
16    branches:
17      - main
18    paths:
19      - 'libcxx/utils/ci/**'
20      - '.github/workflows/libcxx-build-containers.yml'
21  pull_request:
22    branches:
23      - main
24    paths:
25      - 'libcxx/utils/ci/**'
26      - '.github/workflows/libcxx-build-containers.yml'
27
28jobs:
29  build-and-push:
30    runs-on: ubuntu-latest
31    if: github.repository_owner == 'llvm'
32    permissions:
33      packages: write
34
35    steps:
36    - uses: actions/checkout@v4
37
38    - name: Build the Linux builder image
39      working-directory: libcxx/utils/ci
40      run: docker compose build actions-builder
41      env:
42        TAG: ${{ github.sha }}
43
44    # - name: Build the Android builder image
45    #   working-directory: libcxx/utils/ci
46    #   run: docker compose build android-buildkite-builder
47    #   env:
48    #     TAG: ${{ github.sha }}
49
50    - name: Log in to GitHub Container Registry
51      uses: docker/login-action@v3
52      with:
53        registry: ghcr.io
54        username: ${{ github.actor }}
55        password: ${{ secrets.GITHUB_TOKEN }}
56
57    - name: Push the Linux builder image
58      if: github.event_name == 'push'
59      working-directory: libcxx/utils/ci
60      run: |
61        docker compose push actions-builder
62      env:
63        TAG: ${{ github.sha }}
64
65    # - name: Push the Android builder image
66    #   if: github.event_name == 'push'
67    #   working-directory: libcxx/utils/ci
68    #   run: |
69    #     docker compose push android-buildkite-builder
70    #   env:
71    #     TAG: ${{ github.sha }}
72