Skip to content

workflows/premerge: Generate a ccache artifact for each pull request #124311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pr-ccache-restore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PR ccache restore

inputs:
artifact-name-suffix:
desciption: The suffix to append to the artifict name (ccache-pr#)
required: true

runs:
using: "composite"
steps:
- uses: ./.github/workflows/unprivileged-download-artifact
id: download-artifact
with:
artifact-name: ccache-pr${{ github.event.pull_request.number }}-${{ inputs.artifact-name-suffix }}

- shell: bash
if: steps.download-artifact.outputs.filename != ''
run: |
# Is this the best way to clear the cache?
rm -Rf .ccache/
rm ${{ steps.download-artifact.outputs.filename }}
tar --zstd -xf ccache.tar.zst
rm ccache.tar.zst
25 changes: 25 additions & 0 deletions .github/workflows/pr-ccache-save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR ccache save
inputs:
artifact-name-suffix:
desciption: The suffix to append to the artifict name (ccache-pr#)
required: true

runs:
using: "composite"
steps:
- name: Package ccache Directory
shell: bash
run: |
# Dereference symlinks so that this works on Windows.
tar -h -c .ccache | zstd -T0 -c > ccache.tar.zst
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
with:
name: 'ccache-pr${{ github.event.number }}-${{ inputs.artifact-name-suffix }}'
path: ccache.tar.zst
retention-days: 7
overwrite: true

- shell: bash
run: |
rm ccache.tar.zst
ccache --show-stats
13 changes: 13 additions & 0 deletions .github/workflows/premerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
max-size: "2000M"
- name: Install dependencies for pr-ccache-restore
run: |
sudo apt-get install zstd unzip
- name: Restore ccache from previous PR run
uses: ./.github/workflows/pr-ccache-restore
with:
artifact-name-suffix: Linux-x86
- name: Build and Test
# Mark the job as a success even if the step fails so that people do
# not get notified while the new premerge pipeline is in an
Expand Down Expand Up @@ -70,3 +77,9 @@ jobs:
export CXX=/opt/llvm/bin/clang++

./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"

- name: Save ccache for next PR run
if: always()
uses: ./.github/workflows/pr-ccache-save
with:
artifact-name-suffix: Linux-x86
Loading