Skip to content

Commit

Permalink
feat(ci): use BuildJet as self-hosted runner (#3)
Browse files Browse the repository at this point in the history
* chore(docker): separate `rosdep install` and `colcon build` RUN commands (autowarefoundation#4719)

* Use BuildJet as self-hosted runner (#1)

* use buildjet

* remove condition and add pr

* disable update

* remove jq and free disk

* disable condition

* empty

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* Revert "disable condition"

This reverts commit 12f2398.

* disable minimum condition

---------

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* check author

* new use rule

* log json

* refine log

* fix typo

---------

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
  • Loading branch information
youtalk authored May 16, 2024
1 parent a79ef50 commit 0ce5479
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
7 changes: 0 additions & 7 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ runs:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Install jq
run: |
sudo apt-get -y update
sudo apt-get -y install jq
shell: bash

- name: Set Docker tags
id: set-docker-tags
run: |
Expand Down Expand Up @@ -123,7 +117,6 @@ runs:
${{ inputs.build-args }}
- name: Build and Save Artifacts
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
uses: docker/bake-action@v3
with:
push: false
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
name: docker-build-and-push-main

on:
push:
tags:
- adkit-v*.*.*
branches:
- main
schedule:
- cron: 0 0 1,15 * *
pull_request:
workflow_dispatch:
inputs:
artifacts-destination:
Expand All @@ -26,7 +20,7 @@ on:

jobs:
docker-build-and-push-main:
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
fail-fast: false
matrix:
Expand All @@ -44,12 +38,22 @@ jobs:
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")
if [[ "$PR_AUTHOR" == "youtalk" ]]; then
echo "$PR_AUTHOR is a target user"
echo "author-found=true" >> $GITHUB_OUTPUT
else
echo "$PR_AUTHOR is not a target user"
echo "author-found=false" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Check out repository
uses: actions/checkout@v4

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Load env
run: |
cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV
Expand All @@ -58,6 +62,7 @@ jobs:
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
Expand All @@ -70,7 +75,3 @@ jobs:
tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64
tag-prefix: ${{ env.rosdistro }}
allow-push: true

- name: Show disk space
run: |
df -h
6 changes: 4 additions & 2 deletions docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ RUN --mount=type=ssh \
&& apt-get update \
&& rosdep update \
&& DEBIAN_FRONTEND=noninteractive rosdep install -y --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \
&& source /opt/ros/"$ROS_DISTRO"/setup.bash \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

# Build Autoware
RUN source /opt/ros/"$ROS_DISTRO"/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args \
" -Wno-dev" \
" --no-warn-unused-cli" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
&& find /autoware/install -type d -exec chmod 777 {} \; \
&& chmod -R 777 /var/tmp/ccache \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \
&& rm -rf /autoware/build /autoware/src

CMD ["/bin/bash"]
Expand Down

0 comments on commit 0ce5479

Please sign in to comment.