From 8ba1699b7482d328be25b26ecb697e3d48a698d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 10 Dec 2024 16:56:10 +0300 Subject: [PATCH] ci(build-and-test): use self hosted X64 and add ccache to -daily (#9601) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .github/workflows/build-and-test-daily.yaml | 40 ++++++++++++++++++++- .github/workflows/build-and-test.yaml | 2 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test-daily.yaml b/.github/workflows/build-and-test-daily.yaml index 63822f8b1e093..b2612f2fcd1f0 100644 --- a/.github/workflows/build-and-test-daily.yaml +++ b/.github/workflows/build-and-test-daily.yaml @@ -5,9 +5,13 @@ on: - cron: 0 0 * * * workflow_dispatch: +env: + CC: /usr/lib/ccache/gcc + CXX: /usr/lib/ccache/g++ + jobs: build-and-test-daily: - runs-on: [self-hosted, linux, X64, gpu] + runs-on: [self-hosted, Linux, X64] container: ${{ matrix.container }}${{ matrix.container-suffix }} strategy: fail-fast: false @@ -30,6 +34,9 @@ jobs: - name: Show disk space before the tasks run: df -h + - name: Show machine specs + run: lscpu && free -h + - name: Remove exec_depend uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 @@ -37,6 +44,33 @@ jobs: id: get-self-packages uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 + - name: Create ccache directory + run: | + mkdir -p ${CCACHE_DIR} + du -sh ${CCACHE_DIR} && ccache -s + shell: bash + + - name: Attempt to restore ccache + uses: actions/cache/restore@v4 + with: + path: | + /root/.ccache + key: ccache-main-${{ runner.arch }}-${{ matrix.rosdistro }}-${{ github.sha }} + restore-keys: | + ccache-main-${{ runner.arch }}-${{ matrix.rosdistro }}- + + - name: Limit ccache size + run: | + rm -f "${CCACHE_DIR}/ccache.conf" + echo -e "# Set maximum cache size\nmax_size = 600MB" >> "${CCACHE_DIR}/ccache.conf" + shell: bash + + - name: Show ccache stats before build and reset stats + run: | + du -sh ${CCACHE_DIR} && ccache -s + ccache --zero-stats + shell: bash + - name: Export CUDA state as a variable for adding to cache key run: | build_type_cuda_state=nocuda @@ -56,6 +90,10 @@ jobs: build-depends-repos: ${{ matrix.build-depends-repos }} cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }} + - name: Show ccache stats after build + run: du -sh ${CCACHE_DIR} && ccache -s + shell: bash + - name: Test if: ${{ steps.get-self-packages.outputs.self-packages != '' }} id: test diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 3ffa5ebdbd29d..6b3886f124a44 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -16,7 +16,7 @@ env: jobs: build-and-test: - runs-on: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large + runs-on: [self-hosted, Linux, X64] container: ${{ matrix.container }}${{ matrix.container-suffix }} strategy: fail-fast: false