fix(CI): stop ccache from freezing after the first run on a branch (#26481)
Co-authored-by: Ludwig <sudlud@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,7 @@ runs:
|
|||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ${{ github.workspace }}
|
context: ${{ github.workspace }}
|
||||||
file: ${{ inputs.dockerfile }}
|
file: ${{ inputs.dockerfile }}
|
||||||
|
|||||||
@@ -41,14 +41,21 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: echo cache key
|
- name: echo cache key
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}"
|
run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}-${{ github.run_id }}"
|
||||||
|
|
||||||
|
# The primary key is unique per run (`-${{ github.run_id }}`) so every run
|
||||||
|
# saves a fresh cache. A static key would hit on itself on the second run
|
||||||
|
# and `actions/cache` would then skip the upload, freezing the cache after
|
||||||
|
# the first commit on a branch (and permanently on master). The restore-keys
|
||||||
|
# walk back from the most-recent cache on this branch to progressively
|
||||||
|
# broader fallbacks (branch -> pch variant -> modules variant -> compiler).
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/var/ccache
|
path: ${{ github.workspace }}/var/ccache
|
||||||
key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}
|
key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}-${{ github.run_id }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
|
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}-
|
||||||
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}
|
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}
|
||||||
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}
|
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}
|
||||||
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}
|
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}
|
||||||
@@ -78,6 +85,8 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache
|
CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache
|
||||||
|
# CCACHE_COMPRESSLEVEL=3: level 9 burns CPU for marginal size gains on a
|
||||||
|
# cache that never approaches max_size.
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "$CCACHE_DIR"
|
mkdir -p "$CCACHE_DIR"
|
||||||
cat <<EOF >> "$GITHUB_ENV"
|
cat <<EOF >> "$GITHUB_ENV"
|
||||||
@@ -87,7 +96,7 @@ runs:
|
|||||||
CCACHE_MAXSIZE=5G
|
CCACHE_MAXSIZE=5G
|
||||||
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
|
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
|
||||||
CCACHE_COMPRESS=1
|
CCACHE_COMPRESS=1
|
||||||
CCACHE_COMPRESSLEVEL=9
|
CCACHE_COMPRESSLEVEL=3
|
||||||
CCACHE_COMPILERCHECK=content
|
CCACHE_COMPILERCHECK=content
|
||||||
CCACHE_LOGFILE=${{ env.CCACHE_DIR }}/cache.debug
|
CCACHE_LOGFILE=${{ env.CCACHE_DIR }}/cache.debug
|
||||||
CC=${{ inputs.CC }}
|
CC=${{ inputs.CC }}
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ on:
|
|||||||
- "!README.md"
|
- "!README.md"
|
||||||
- "!docs/**"
|
- "!docs/**"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# New commits on a PR cancel the still-running codestyle check on the old
|
||||||
|
# commit. github.ref is refs/pull/<N>/merge, so the group is stable per PR.
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
triage:
|
triage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Trigger acore-docker CI
|
- name: Trigger acore-docker CI
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
||||||
uses: peter-evans/repository-dispatch@v2
|
uses: peter-evans/repository-dispatch@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}
|
||||||
repository: azerothcore/acore-docker
|
repository: azerothcore/acore-docker
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
# One concurrency group per workflow + ref (matches the other build workflows).
|
||||||
|
# PRs cancel superseded runs; branch pushes are isolated by ref.
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -35,9 +37,11 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/Library/Caches/ccache
|
path: ~/Library/Caches/ccache
|
||||||
key: ccache:${{ matrix.os }}:${{ github.ref_name }}
|
# Unique per run so the cache is re-saved every run instead of
|
||||||
|
# freezing on the first (a static key hits itself and skips upload).
|
||||||
|
key: ccache:${{ matrix.os }}:${{ github.ref_name }}-${{ github.run_id }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ccache:${{ matrix.os }}:${{ github.ref_name }}
|
ccache:${{ matrix.os }}:${{ github.ref_name }}-
|
||||||
ccache:${{ matrix.os }}
|
ccache:${{ matrix.os }}
|
||||||
- name: reset ccache stats
|
- name: reset ccache stats
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ on:
|
|||||||
- "!README.md"
|
- "!README.md"
|
||||||
- "!docs/**"
|
- "!docs/**"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# New commits on a PR cancel the still-running codestyle check on the old
|
||||||
|
# commit. github.ref is refs/pull/<N>/merge, so the group is stable per PR.
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
triage:
|
triage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user