diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 91f82916a91..40b9ee3f022 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -22,9 +22,6 @@ inputs: runs: using: composite steps: - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Install jq and vcstool run: | sudo apt-get -y update @@ -59,7 +56,7 @@ runs: - name: Docker meta for prebuilt id: meta-prebuilt - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} @@ -70,7 +67,7 @@ runs: - name: Docker meta for devel id: meta-devel - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} @@ -82,7 +79,7 @@ runs: - name: Docker meta for runtime if: ${{ github.event_name == 'workflow_dispatch' }} || ${{ (github.event_name == 'push' && github.ref_type == 'tag') }} id: meta-runtime - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: ${{ steps.set-docker-tags.outputs.tags }} @@ -101,7 +98,7 @@ runs: - name: Build and Push to GitHub Container Registry if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'registry') }} - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: ${{ inputs.allow-push == 'true' }} files: | @@ -115,7 +112,7 @@ runs: - name: Build only if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: push: false files: | diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index 73354230d98..eb178be3c27 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -46,6 +46,9 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set git config uses: autowarefoundation/autoware-github-actions/set-git-config@v1 with: @@ -54,6 +57,25 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + root-ccache + key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }} + restore-keys: | + cache-${{ matrix.platform }}-${{ matrix.name }}- + cache-${{ matrix.platform }}- + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "root-ccache": "/root/.ccache" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Build 'Autoware' uses: ./.github/actions/docker-build-and-push with: diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index 859c754c169..76bf9d5b9dc 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -41,6 +41,9 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set git config uses: autowarefoundation/autoware-github-actions/set-git-config@v1 with: @@ -49,6 +52,25 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + root-ccache + key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }} + restore-keys: | + cache-${{ matrix.platform }}-${{ matrix.name }}- + cache-${{ matrix.platform }}- + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "root-ccache": "/root/.ccache" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Build 'Autoware' uses: ./.github/actions/docker-build-and-push with: diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 0d44a72ed30..6af6d592294 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -58,6 +58,9 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set git config uses: autowarefoundation/autoware-github-actions/set-git-config@v1 with: @@ -66,6 +69,25 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + root-ccache + key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }} + restore-keys: | + cache-${{ matrix.platform }}-${{ matrix.name }}- + cache-${{ matrix.platform }}- + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "root-ccache": "/root/.ccache" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Build 'Autoware' uses: ./.github/actions/docker-build-and-push with: diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index c0267f95ba4..0703ffc3daa 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -53,6 +53,9 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set git config uses: autowarefoundation/autoware-github-actions/set-git-config@v1 with: @@ -61,6 +64,25 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: | + root-ccache + key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }} + restore-keys: | + cache-${{ matrix.platform }}-${{ matrix.name }}- + cache-${{ matrix.platform }}- + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "root-ccache": "/root/.ccache" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Build 'Autoware' uses: ./.github/actions/docker-build-and-push with: diff --git a/docker/Dockerfile b/docker/Dockerfile index d97b55c8cdd..89c41b96a90 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -66,8 +66,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG SETUP_ARGS ENV CCACHE_DIR="/var/tmp/ccache" -ENV CC="/usr/lib/ccache/gcc" -ENV CXX="/usr/lib/ccache/g++" # cspell: ignore libcu libnv # Set up development environment @@ -90,13 +88,13 @@ RUN --mount=type=ssh \ COPY --from=src-imported /autoware/src /autoware/src RUN --mount=type=cache,target=${CCACHE_DIR} \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && du -sh ${CCACHE_DIR} && ccache -s \ && colcon build --cmake-args \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ " -Wno-dev" \ " --no-warn-unused-cli" \ + --mixin release compile-commands ccache \ + && du -sh ${CCACHE_DIR} && ccache -s \ && find /autoware/install -type d -exec chmod 777 {} \; \ - && chmod -R 777 /var/tmp/ccache \ && rm -rf /autoware/build /autoware/src CMD ["/bin/bash"]