Skip to content

feat(ci): use BuildJet as self-hosted runner #2

feat(ci): use BuildJet as self-hosted runner

feat(ci): use BuildJet as self-hosted runner #2

# 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:
pull_request:
workflow_dispatch:
inputs:
artifacts-destination:
type: choice
description: Destination for the artifacts
options:
- registry
- tarball
default: tarball
jobs:
docker-build-and-push-main:
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
name:
- no-cuda
- cuda
include:
- name: no-cuda
base_image_env: base_image
lib_dir: x86_64
setup-args: --no-nvidia
additional-tag-suffix: ""
- name: cuda
base_image_env: base_image
lib_dir: x86_64
additional-tag-suffix: -cuda
steps:
- name: Check if PR author is the specific user
id: author-check
run: |
PR_AUTHOR=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
echo $(jq "$GITHUB_EVENT_PATH")
echo "PR_AUTHOR=$PR_AUTHOR"
if [[ "$PR_AUTHOR" == "youtalk" ]]; then
echo "Author is target-user"
echo "author-foud=true" >> $GITHUB_OUTPUT
else
echo "Author is not target-user"
echo "author-foud=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Check out repository
uses: actions/checkout@v4
- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
if [ "$(uname -m)" = "aarch64" ]; then
cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
fi
- name: Build 'autoware-openadk'
if: steps.author-check.outputs.author-found == 'true'
uses: ./.github/actions/docker-build-and-push
with:
bake-target: autoware-openadk
build-args: |
*.platform=linux/amd64
*.args.ROS_DISTRO=${{ env.rosdistro }}
*.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }}
*.args.SETUP_ARGS=${{ matrix.setup-args }}
*.args.LIB_DIR=${{ matrix.lib_dir }}
tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64
tag-prefix: ${{ env.rosdistro }}
allow-push: true