brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · a49ad81 Raw
85 lines · yaml
1# This file defines an action that builds the various Docker images used to run2# 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/packages5# 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++ CI9 10permissions:11  contents: read12 13on:14  push:15    branches:16      - main17    paths:18      - 'libcxx/utils/ci/docker/**'19      - '.github/workflows/libcxx-build-containers.yml'20  pull_request:21    paths:22      - 'libcxx/utils/ci/docker/**'23      - '.github/workflows/libcxx-build-containers.yml'24 25jobs:26  build-and-push:27    runs-on: ubuntu-24.0428    if: github.repository_owner == 'llvm'29    permissions:30      packages: write31 32    steps:33    - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.034 35    # The default Docker storage location for GitHub Actions doesn't have36    # enough disk space, so change it to /mnt, which has more disk space.37    - name: Change Docker storage location38      run: |39        sudo mkdir /mnt/docker40        echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json41        sudo systemctl restart docker42 43    - name: Build the base image44      run: docker compose --file libcxx/utils/ci/docker/docker-compose.yml build libcxx-linux-builder-base45      env:46        TAG: ${{ github.sha }}47 48    - name: Build the Linux Github Actions image49      run: docker compose --file libcxx/utils/ci/docker/docker-compose.yml build libcxx-linux-builder50      env:51        TAG: ${{ github.sha }}52 53    - name: Build the Android builder image54      run: docker compose --file libcxx/utils/ci/docker/docker-compose.yml build libcxx-android-builder55      env:56        TAG: ${{ github.sha }}57 58    - name: Log in to GitHub Container Registry59      uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.060      with:61        registry: ghcr.io62        username: ${{ github.actor }}63        password: ${{ secrets.GITHUB_TOKEN }}64 65    - name: Push the images66      if: github.event_name == 'push'67      run: docker compose --file libcxx/utils/ci/docker/docker-compose.yml push libcxx-linux-builder-base libcxx-linux-builder libcxx-android-builder68      env:69        TAG: ${{ github.sha }}70 71    # We create tarballs with the images and upload them as artifacts, since that's useful for testing72    # the images when making changes.73    - name: Create image tarballs74      run: |75        docker image save ghcr.io/llvm/libcxx-linux-builder-base:${{ github.sha }} | gzip > libcxx-linux-builder-base.tar.gz76        docker image save ghcr.io/llvm/libcxx-linux-builder:${{ github.sha }} | gzip > libcxx-linux-builder.tar.gz77        docker image save ghcr.io/llvm/libcxx-android-builder:${{ github.sha }} | gzip > libcxx-android-builder.tar.gz78    - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.079      with:80          name: libcxx-docker-images81          path: |82            libcxx-linux-builder-base.tar.gz83            libcxx-linux-builder.tar.gz84            libcxx-android-builder.tar.gz85