Skip to content
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

Improve ccache use on github workflows #1243

Merged
merged 8 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
24 changes: 22 additions & 2 deletions .github/workflows/build-ultralite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ concurrency:
group: build-ultralite-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}}
cancel-in-progress: true

# env:
# CCACHE_DEBUG: 1
# CCACHE_DEBUGDIR: ${{github.workspace}}/ccache-debug

jobs:
linux:
name: ultralite-ubuntu
env:
CCACHE_DIR: "${{github.workspace}}/.ccache"
CCACHE_MAXSIZE: "20Mi"
CCACHE_MAXSIZE: "50Mi"
CMAKE_PRESET: ultralite
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -61,11 +65,19 @@ jobs:
if: ${{!cancelled()}}
run: |
ccache -s
- name: Upload ccache debug
if: ${{env.CCACHE_DEBUG && !cancelled()}}
uses: actions/upload-artifact@v4
with:
path: ${{env.CCACHE_DEBUGDIR}}
name: ccache-debug-${{github.job}}
overwrite: true
retention-days: 7
windows:
name: ultralite-windows
env:
CCACHE_DIR: "${{github.workspace}}\\.ccache"
CCACHE_MAXSIZE: "20Mi"
CCACHE_MAXSIZE: "50Mi"
CMAKE_PRESET: ultralite
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -105,5 +117,13 @@ jobs:
if: ${{!cancelled()}}
run: |
ccache -s
- name: Upload ccache debug
if: ${{env.CCACHE_DEBUG && !cancelled()}}
uses: actions/upload-artifact@v4
with:
path: ${{env.CCACHE_DEBUGDIR}}
name: ccache-debug-${{github.job}}
overwrite: true
retention-days: 7

# vim: set nowrap tw=100:
29 changes: 29 additions & 0 deletions .github/workflows/clear-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: clear-cache

on:
workflow_dispatch:
workflow_call:

jobs:
clear-cache:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it run on all the platform with CCache? (I.e. eg Windows?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. All it's doing is making GitHub calls; the cache itself is platform agnostic.

steps:
- name: Clear ccache
uses: actions/github-script@v7
with:
script: |
console.log("Getting action cache")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
if (cache.key.startsWith("ccache-") {
console.log("Deleting cache entry", cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
}
36 changes: 36 additions & 0 deletions .github/workflows/cron_weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pull_request
run-name: >-
${{github.event.pull_request.title}}
(#${{github.event.number}})

on:
schedule:
- cron: "33 06 * * 0" # Sunday at 6:33 am UTC

jobs:
clear-ccache:
uses: ./.github/workflows/clear-cache.yml
build-fast:
needs: [clear-cache]
uses: ./.github/workflows/build-fast.yml
build-ultralite:
needs: [clear-cache]
uses: ./.github/workflows/build-ultralite.yml
build-spack:
needs: [clear-cache]
uses: ./.github/workflows/build-spack.yml

all:
if: ${{always()}}
needs:
- build-fast
- build-spack
- build-ultralite
runs-on: ubuntu-latest
steps:
- name: Check that all jobs succeeded
uses: re-actors/alls-green@release/v1
with:
jobs: ${{toJSON(needs)}}

# vim: set nowrap tw=100:
18 changes: 12 additions & 6 deletions .github/workflows/merge_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ concurrency:
cancel-in-progress: true

jobs:
# TODO: use a more limited build for merge group? (or for PR?)
build:
uses: ./.github/workflows/build-full.yml
build-docker:
uses: ./.github/workflows/build-docker.yml
build-spack:
uses: ./.github/workflows/build-spack.yml
all:
needs: [build]
if: ${{always()}}
needs:
- build-docker
- build-spack
runs-on: ubuntu-latest
steps:
- name: Success
run: "true"
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{toJSON(needs)}}

# vim: set nowrap tw=100:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pr
name: pull_request
run-name: >-
${{github.event.pull_request.title}}
(#${{github.event.number}})
Expand Down
1 change: 1 addition & 0 deletions scripts/cmake-presets/ci-ubuntu-github.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"CELERITAS_USE_ROOT": {"type": "BOOL", "value": "OFF"},
"CELERITAS_USE_SWIG": {"type": "BOOL", "value": "OFF"},
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"},
"CELERITAS_HOSTNAME": "ubuntu-github",
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_EXTENSIONS": {"type": "BOOL", "value": "OFF"},
Expand Down
1 change: 1 addition & 0 deletions scripts/cmake-presets/ci-windows-github.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"CELERITAS_USE_ROOT": {"type": "BOOL", "value": "OFF"},
"CELERITAS_USE_SWIG": {"type": "BOOL", "value": "OFF"},
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "OFF"},
"CELERITAS_HOSTNAME": "windows-github",
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_EXTENSIONS": {"type": "BOOL", "value": "OFF"},
Expand Down
Loading