Skip to content

refactor(ci): use platform arg to replace raw string (#4844) #268

refactor(ci): use platform arg to replace raw string (#4844)

refactor(ci): use platform arg to replace raw string (#4844) #268

# EVENTS: push, schedule, workflow_dispatch
# workflow_dispatch: Build all. No publish to registry; save as tarball.
# schedule: Build only devel and prebuilt. TAGS: date, latest
# push-branch: Build only devel and prebuilt. TAGS: date, latest
# push-tag: Build all. TAGS: version, date, latest
name: docker-build-and-push-main
on:
push:
tags:
- openadkit-v*.*.*
branches:
- main
schedule:
- cron: 0 0 1,15 * *
workflow_dispatch:
inputs:
artifacts-destination:
type: choice
description: Destination for the artifacts
options:
- registry
- tarball
default: tarball
jobs:
load-env:
uses: ./.github/workflows/load-env.yaml
docker-build-and-push-main:
needs: load-env
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
name:
- no-cuda
- cuda
include:
- name: no-cuda
base_image_env: base_image
platform: amd64
lib_dir: x86_64
setup-args: --no-nvidia
additional-tag-suffix: ""
- name: cuda
base_image_env: base_image
platform: amd64
lib_dir: x86_64
additional-tag-suffix: -cuda
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install vcstool
run: |
sudo apt-get -y update
sudo apt-get -y install python3-pip
pip install --no-cache-dir vcstool
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Free disk space
uses: ./.github/actions/free-disk-space
- name: Run vcs import
run: |
mkdir src
vcs import src < autoware.repos
- name: Build 'Autoware'
uses: ./.github/actions/docker-build-and-push
with:
bake-target: autoware
build-args: |
*.platform=linux/${{ matrix.platform }}
*.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }}
*.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }}
*.args.SETUP_ARGS=${{ matrix.setup-args }}
*.args.LIB_DIR=${{ matrix.lib_dir }}
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }}-${{ matrix.platform }}
*.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}:buildcache-${{ matrix.name }}-${{ matrix.platform }},mode=max
tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64
tag-prefix: ${{ needs.load-env.outputs.rosdistro }}
allow-push: true
- name: Show disk space
run: |
df -h