diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 197426c65741a8..738158f2d956da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,7 @@ on: pull_request_target: permissions: + actions: write contents: read packages: write @@ -86,24 +87,36 @@ jobs: restore-keys: | depends-sources- - - name: Cache dependencies - uses: actions/cache@v4 + - name: Restore depends cache + id: cache-restore-deps + uses: actions/cache/restore@v4 with: path: | depends/built + depends/${{ matrix.host }} key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} - restore-keys: | - ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} - ${{ runner.os }}-depends-${{ matrix.build_target }} - - name: Build dependencies + - name: Build depends run: make -j$(nproc) -C depends HOST=${{ matrix.host }} - - name: Upload built depends - uses: actions/upload-artifact@v4 + - name: Delete depends cache + id: cache-delete-deps + if: ${{ steps.cache-restore-deps.outputs.cache-hit }} + continue-on-error: true + run: | + git config --global --add safe.directory "$(pwd)" + gh cache delete "${{ steps.cache-restore-deps.outputs.cache-primary-key }}" + env: + GH_TOKEN: ${{ github.token }} + + - name: Save depends cache + id: cache-save-deps + uses: actions/cache/save@v4 with: - name: depends-${{ matrix.build_target }} - path: depends/${{ matrix.host }} + path: | + depends/built + depends/${{ matrix.host }} + key: ${{ steps.cache-restore-deps.outputs.cache-primary-key }} build: name: Build @@ -146,11 +159,13 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Download built depends - uses: actions/download-artifact@v4 + - name: Restore depends cache + uses: actions/cache/restore@v4 with: - name: depends-${{ matrix.depends_on }} - path: depends/${{ matrix.host }} + path: | + depends/built + depends/${{ matrix.host }} + key: ${{ runner.os }}-depends-${{ matrix.depends_on }}-${{ hashFiles('depends/packages/*') }} - name: Determine PR Base SHA id: vars diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index f80a1b5174b5cf..b8b9fc0078d761 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -150,6 +150,15 @@ RUN cd /tmp && \ /tmp/llvm.sh ${LLVM_VERSION} && \ rm -rf /tmp/llvm.sh +# Install GitHub CLI for GitHub Actions usage +RUN \ + mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg > /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list; \ + apt-get update && apt-get install $APT_ARGS gh \ + && rm -rf /var/lib/apt/lists/*; + RUN \ mkdir -p /src/dash && \ mkdir -p /cache/ccache && \