github.com/pdmccormick/importable-docker-buildx@v0.0.0-20240426161518-e47091289030/.github/workflows/e2e.yml (about)

     1  name: e2e
     2  
     3  concurrency:
     4    group: ${{ github.workflow }}-${{ github.ref }}
     5    cancel-in-progress: true
     6  
     7  on:
     8    workflow_dispatch:
     9    push:
    10      branches:
    11        - 'master'
    12        - 'v[0-9]*'
    13    pull_request:
    14      paths-ignore:
    15        - '.github/releases.json'
    16        - 'README.md'
    17        - 'docs/**'
    18  
    19  env:
    20    DESTDIR: "./bin"
    21    K3S_VERSION: "v1.21.2-k3s1"
    22  
    23  jobs:
    24    build:
    25      runs-on: ubuntu-22.04
    26      steps:
    27        - name: Checkout
    28          uses: actions/checkout@v4
    29        -
    30          name: Set up Docker Buildx
    31          uses: docker/setup-buildx-action@v3
    32          with:
    33            version: latest
    34        -
    35          name: Build
    36          uses: docker/bake-action@v4
    37          with:
    38            targets: binaries
    39            set: |
    40              *.cache-from=type=gha,scope=release
    41              *.cache-from=type=gha,scope=binaries
    42              *.cache-to=type=gha,scope=binaries
    43        -
    44          name: Rename binary
    45          run: |
    46            mv ${{ env.DESTDIR }}/build/buildx ${{ env.DESTDIR }}/build/docker-buildx
    47        -
    48          name: Upload artifacts
    49          uses: actions/upload-artifact@v4
    50          with:
    51            name: binary
    52            path: ${{ env.DESTDIR }}/build
    53            if-no-files-found: error
    54            retention-days: 7
    55  
    56    driver:
    57      runs-on: ubuntu-20.04
    58      needs:
    59        - build
    60      strategy:
    61        fail-fast: false
    62        matrix:
    63          driver:
    64            - docker
    65            - docker-container
    66            - kubernetes
    67            - remote
    68          buildkit:
    69            - moby/buildkit:buildx-stable-1
    70            - moby/buildkit:master
    71          buildkit-cfg:
    72            - bkcfg-false
    73            - bkcfg-true
    74          multi-node:
    75            - mnode-false
    76            - mnode-true
    77          platforms:
    78            - linux/amd64
    79            - linux/amd64,linux/arm64
    80          include:
    81            - driver: kubernetes
    82              driver-opt: qemu.install=true
    83            - driver: remote
    84              endpoint: tcp://localhost:1234
    85            - driver: docker-container
    86              metadata-provenance: max
    87          exclude:
    88            - driver: docker
    89              multi-node: mnode-true
    90            - driver: docker
    91              buildkit-cfg: bkcfg-true
    92            - driver: docker-container
    93              multi-node: mnode-true
    94            - driver: remote
    95              multi-node: mnode-true
    96            - driver: remote
    97              buildkit-cfg: bkcfg-true
    98      steps:
    99        -
   100          name: Checkout
   101          uses: actions/checkout@v4
   102        -
   103          name: Set up QEMU
   104          uses: docker/setup-qemu-action@v3
   105          if: matrix.driver == 'docker' || matrix.driver == 'docker-container'
   106        -
   107          name: Install buildx
   108          uses: actions/download-artifact@v4
   109          with:
   110            name: binary
   111            path: /home/runner/.docker/cli-plugins
   112        -
   113          name: Fix perms and check
   114          run: |
   115            chmod +x /home/runner/.docker/cli-plugins/docker-buildx
   116            docker buildx version
   117        -
   118          name: Init env vars
   119          run: |
   120            # BuildKit cfg
   121            if [ "${{ matrix.buildkit-cfg }}" = "bkcfg-true" ]; then
   122              cat > "/tmp/buildkitd.toml" <<EOL
   123            [worker.oci]
   124              max-parallelism = 2
   125            EOL
   126              echo "BUILDKIT_CFG=/tmp/buildkitd.toml" >> $GITHUB_ENV
   127            fi
   128            # Multi node
   129            if [ "${{ matrix.multi-node }}" = "mnode-true" ]; then
   130              echo "MULTI_NODE=1" >> $GITHUB_ENV
   131            else
   132              echo "MULTI_NODE=0" >> $GITHUB_ENV
   133            fi
   134            if [ -n "${{ matrix.metadata-provenance }}" ]; then
   135              echo "BUILDX_METADATA_PROVENANCE=${{ matrix.metadata-provenance }}" >> $GITHUB_ENV
   136            fi
   137        -
   138          name: Install k3s
   139          if: matrix.driver == 'kubernetes'
   140          uses: crazy-max/.github/.github/actions/install-k3s@fa6141aedf23596fb8bdcceab9cce8dadaa31bd9
   141          with:
   142            version: ${{ env.K3S_VERSION }}
   143        -
   144          name: Launch remote buildkitd
   145          if: matrix.driver == 'remote'
   146          run: |
   147            docker run -d \
   148              --privileged \
   149              --name=remote-buildkit \
   150              -p 1234:1234 \
   151              ${{ matrix.buildkit }} \
   152              --addr unix:///run/buildkit/buildkitd.sock \
   153              --addr tcp://0.0.0.0:1234
   154        -
   155          name: Test
   156          run: |
   157            make test-driver
   158          env:
   159            BUILDKIT_IMAGE: ${{ matrix.buildkit }}
   160            DRIVER: ${{ matrix.driver }}
   161            DRIVER_OPT: ${{ matrix.driver-opt }}
   162            ENDPOINT: ${{ matrix.endpoint }}
   163            PLATFORMS: ${{ matrix.platforms }}