Cleanup bake file and move versions into yml file #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker Images | |
on: push | |
jobs: | |
define-matrix: | |
name: "Prepare" | |
runs-on: ubuntu-24.04 | |
outputs: | |
distros: ${{ steps.matrix.outputs.distros }} | |
cmake_versions: ${{ steps.matrix.outputs.cmake_versions }} | |
clangs: ${{ steps.matrix.outputs.clangs }} | |
gccs: ${{ steps.matrix.outputs.gccs }} | |
qts: ${{ steps.matrix.outputs.qts }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Define Matrix | |
id: matrix | |
shell: python {0} >> "$GITHUB_OUTPUT" | |
run: | | |
import yaml | |
with open('docker_build_matrix.yml', 'r') as file: | |
matrix = yaml.safe_load(file) | |
import os | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | |
import json | |
print(f'distros=[{json.dumps(matrix["distro"])}]', file=fh) | |
print(f'cmake_versions={json.dumps(matrix['cmake'])}', file=fh) | |
print(f'clangs={json.dumps(matrix['clang'])}', file=fh) | |
print(f'gccs={json.dumps(matrix['gcc'])}', file=fh) | |
print(f'qts={json.dumps(matrix['qt'])}', file=fh) | |
cmake: | |
name: "Build" | |
needs: define-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
cmake_version: ${{ fromJSON(needs.define-matrix.outputs.cmake_versions) }} | |
qt: ${{ fromJSON(needs.define-matrix.outputs.qts) }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/bake-action@v5 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
env: | |
ALL_DISTROS: ${{ needs.define-matrix.outputs.distros }} | |
ALL_CMAKE_VERSIONS: ${{ needs.define-matrix.outputs.cmake_versions }} | |
ALL_CLANGS: ${{ needs.define-matrix.outputs.clangs }} | |
ALL_GCCS: ${{ needs.define-matrix.outputs.gccs }} | |
ALL_QTS: ${{ needs.define-matrix.outputs.qts }} | |
CMAKE_VERSIONS: | | |
[${{ toJSON(matrix.cmake_version) }}] | |
QTS: | | |
[${{ toJSON(matrix.qt) }}] |