Skip to content

Bump docker/build-push-action from 5.0.0 to 6.5.0 #324

Bump docker/build-push-action from 5.0.0 to 6.5.0

Bump docker/build-push-action from 5.0.0 to 6.5.0 #324

Workflow file for this run

name: CI
on:
pull_request:
branches: main
push:
branches: main
permissions:
contents: read
packages: write
concurrency:
group: ci-${{github.ref}}
cancel-in-progress: ${{github.ref != 'refs/heads/main'}}
jobs:
build:
name: Build (${{matrix.compiler.c}})
runs-on: ubuntu-latest
strategy:
matrix:
compiler:
- packages: clang-9
c: clang-9
cpp: clang++-9
- packages: clang-10
c: clang-10
cpp: clang++-10
- packages: clang-11
c: clang-11
cpp: clang++-11
- packages: clang-12
c: clang-12
cpp: clang++-12
- packages: gcc-9 g++-9
c: gcc-9
cpp: g++-9
- packages: gcc-10 g++-10
c: gcc-10
cpp: g++-10
- packages: gcc-11 g++-11
c: gcc-11
cpp: g++-11
steps:
- name: Checkout
uses: actions/[email protected]
- name: Gather info
id: info
run: |
PACKAGE='ghcr.io/${{github.repository_owner}}/build-linux'
PACKAGE="${PACKAGE}:${{matrix.compiler.c}}"
TAGS="${PACKAGE}"
CACHE_BASE_KEY="buildx-${{matrix.compiler.c}}-"
FILE_HASH="${{hashFiles('Dockerfile', '.dockerignore')}}"
CACHE_KEY="${CACHE_BASE_KEY}${FILE_HASH}"
echo "##[set-output name=package;]${PACKAGE,,}"
echo "##[set-output name=tags;]${TAGS,,}"
echo "##[set-output name=cache-key;]${CACHE_KEY}"
echo "##[set-output name=cache-restore-keys;]${CACHE_BASE_KEY}"
- name: Set up docker buildx
id: buildx
uses: docker/[email protected]
with:
version: latest
- name: Set up cache
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{steps.info.outputs.cache-key}}
restore-keys: ${{steps.info.outputs.cache-restore-keys}}
- name: Build image
uses: docker/[email protected]
with:
builder: ${{steps.buildx.outputs.name}}
context: .
tags: ${{steps.info.outputs.tags}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
build-args: |
COMPILER_PACKAGES=${{matrix.compiler.packages}}
C_COMPILER_NAME=${{matrix.compiler.c}}
CPP_COMPILER_NAME=${{matrix.compiler.cpp}}
push: false
load: true
- name: Report image details
run: >
docker image history
--format "table {{.Size}}\t{{.CreatedBy}}"
${{steps.info.outputs.package}}
- name: Run tests
run: >
docker run --rm ${{steps.info.outputs.package}}
sh -c 'cc --version && c++ --version && cmake --version &&
ninja --version && make --version && git --version &&
python --version && sccache --version'
- name: Login into registry
if: github.ref == 'refs/heads/main'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{github.token}}
- name: Push image
if: github.ref == 'refs/heads/main'
uses: docker/[email protected]
with:
builder: ${{steps.buildx.outputs.name}}
context: .
tags: ${{steps.info.outputs.tags}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
build-args: |
COMPILER_PACKAGES=${{matrix.compiler.packages}}
C_COMPILER_NAME=${{matrix.compiler.c}}
CPP_COMPILER_NAME=${{matrix.compiler.cpp}}
push: true