Skip to content

#175: Make layout parameters optional and let vt-tv make best guess in their absence #396

#175: Make layout parameters optional and let vt-tv make best guess in their absence

#175: Make layout parameters optional and let vt-tv make best guess in their absence #396

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: vt-tv-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": "/opt/conda",
"id": "conda-${{ 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 }}
- 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=/opt/build/vt-tv \
mkdir -p /vt-tv \
&& cp -p -R /opt/build/vt-tv/. /vt-tv/ || true
" >> tmp_dockerfile
docker buildx build --builder ${{ steps.setup-buildx.outputs.name }} -f tmp_dockerfile --output type=local,dest=build .
- name: Upload coverage
if: ${{ matrix.target == 'vt-tv-build-amd64-ubuntu-22-04-gcc-12-vtk-cpp' }}
uses: codecov/codecov-action@v5
with:
files: build/vt-tv/coverage.info
token: ${{ secrets.CODECOV_TOKEN }}