Skip to content

Merge pull request #32 from DARMA-tasking/31-get-new-mapping-globally… #124

Merge pull request #32 from DARMA-tasking/31-get-new-mapping-globally…

Merge pull request #32 from DARMA-tasking/31-get-new-mapping-globally… #124

name: CI
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.list-targets.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: List targets
id: list-targets
uses: docker/bake-action/subaction/list-targets@v6
with:
target: lb-build-all
bake:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: setup-buildx
uses: docker/setup-buildx-action@v3
- uses: actions/cache@v4
id: ccache-archive
with:
path: ccache-archive
key: ${{ matrix.target }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.target }}-${{ github.ref }}
${{ matrix.target }}-
- name: Inject ccache
uses: reproducible-containers/buildkit-cache-dance@v3
with:
builder: ${{ steps.setup-buildx.outputs.name }}
cache-map: |
{
"ccache-archive": {
"target": "/build/ccache",
"id": "${{ matrix.target }}"
}
}
skip-extraction: ${{ steps.ccache-archive.outputs.cache-hit }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: docker/bake-action@v6
id: build-image
with:
source: .
targets: ${{ matrix.target }}
files: docker-bake.hcl
push: ${{ github.ref == 'refs/heads/master' }}
set: |
*.args.CACHE_ID=${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
- name: Retrieve build artifacts
run: |
# We rely on the persistence of data on cache mounts with identical IDs and builders.
# This allows us to copy build artifacts from the "bake" step and use the Codecov action within the GitHub environment.
echo "
FROM ubuntu:latest
RUN --mount=type=cache,id=BUILD-${{ matrix.target }},target=/build/LB \
mkdir -p /LB \
&& cp -p -R /build/LB/. /LB/ || true
" >> tmp_dockerfile
docker buildx build --builder ${{ steps.setup-buildx.outputs.name }} -f tmp_dockerfile --output type=local,dest=build .