mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(CI): improve caching (#23387)
This commit is contained in:
56
.github/actions/linux-build/action.yml
vendored
56
.github/actions/linux-build/action.yml
vendored
@@ -39,6 +39,10 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
- name: echo cache key
|
||||||
|
shell: bash
|
||||||
|
run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref_name }}"
|
||||||
|
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
if: inputs.pch != 'true'
|
if: inputs.pch != 'true'
|
||||||
@@ -46,9 +50,8 @@ runs:
|
|||||||
path: ${{ github.workspace }}/var/ccache
|
path: ${{ github.workspace }}/var/ccache
|
||||||
# format
|
# format
|
||||||
# ccache:OS:CC_CXX:MODULES:GITHUB_REF:GITHUB_SHA
|
# ccache:OS:CC_CXX:MODULES:GITHUB_REF:GITHUB_SHA
|
||||||
key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref }}:${{ github.sha }}
|
key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref_name }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref }}
|
|
||||||
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 }}
|
||||||
|
|
||||||
@@ -73,12 +76,12 @@ runs:
|
|||||||
UBUNTU_VERSION="$(grep VERSION_ID /etc/os-release | cut -f2 -d\")"
|
UBUNTU_VERSION="$(grep VERSION_ID /etc/os-release | cut -f2 -d\")"
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
if [[ "$VERSION_CODENAME" == "jammy" ]]; then
|
if [[ "$VERSION_CODENAME" == "jammy" ]]; then
|
||||||
if [[ "${{ inputs.cc }}" =~ "clang-" ]]; then
|
if [[ "${{ inputs.CC }}" =~ "clang-" ]]; then
|
||||||
CLANG_VERSION="$(echo '${{ inputs.cc }}' | cut -f2 -d\-)"
|
CLANG_VERSION="$(echo '${{ inputs.CC }}' | cut -f2 -d\-)"
|
||||||
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
sudo add-apt-repository "deb http://apt.llvm.org/$VERSION_CODENAME/ llvm-toolchain-$VERSION_CODENAME-$CLANG_VERSION main"
|
sudo add-apt-repository "deb http://apt.llvm.org/$VERSION_CODENAME/ llvm-toolchain-$VERSION_CODENAME-$CLANG_VERSION main"
|
||||||
sudo apt-get -qq update
|
sudo apt-get -qq update
|
||||||
sudo apt-get -qq install '${{ inputs.cc }}'
|
sudo apt-get -qq install '${{ inputs.CC }}'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -87,19 +90,44 @@ runs:
|
|||||||
env:
|
env:
|
||||||
CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache
|
CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache
|
||||||
run: |
|
run: |
|
||||||
cat <<EOF >> $GITHUB_ENV
|
mkdir -p "$CCACHE_DIR"
|
||||||
|
cat <<EOF >> "$GITHUB_ENV"
|
||||||
|
CCACHE_BASEDIR=${GITHUB_WORKSPACE}
|
||||||
CCACHE_DIR=${{ env.CCACHE_DIR }}
|
CCACHE_DIR=${{ env.CCACHE_DIR }}
|
||||||
CCACHE_MAXSIZE=1000MB
|
CCACHE_HASHDIR=1
|
||||||
|
CCACHE_MAXSIZE=5G
|
||||||
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
|
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
|
||||||
CCACHE_CPP2=true
|
|
||||||
CCACHE_COMPRESS=1
|
CCACHE_COMPRESS=1
|
||||||
CCACHE_COMPRESSLEVEL=9
|
CCACHE_COMPRESSLEVEL=9
|
||||||
CCACHE_COMPILERCHECK=content
|
CCACHE_COMPILERCHECK=content
|
||||||
CCACHE_LOGFILE=$CCACHE_DIR/cache.debug
|
CCACHE_LOGFILE=${{ env.CCACHE_DIR }}/cache.debug
|
||||||
CC=${{ inputs.CC }}
|
CC=${{ inputs.CC }}
|
||||||
CXX=${{ inputs.CXX }}
|
CXX=${{ inputs.CXX }}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
- name: ccache config snapshot
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "==== Effective ccache configuration ===="
|
||||||
|
ccache -p | egrep 'base_dir|hash_dir|compiler_check|sloppiness|max_size' || true
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "==== Compiler info ===="
|
||||||
|
which ${{ inputs.CC }} && ${{ inputs.CC }} --version || true
|
||||||
|
which ${{ inputs.CXX }} && ${{ inputs.CXX }} --version || true
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "==== Previous cache stats ===="
|
||||||
|
ccache -s || true
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "==== Top cache results ===="
|
||||||
|
grep -o 'result: .*' "$CCACHE_DIR/cache.debug" 2>/dev/null | sort | uniq -c | sort -nr | head || true
|
||||||
|
|
||||||
|
- name: reset ccache stats
|
||||||
|
shell: bash
|
||||||
|
run: ccache -z || true
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -107,6 +135,8 @@ runs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake "$GITHUB_WORKSPACE" \
|
cmake "$GITHUB_WORKSPACE" \
|
||||||
|
-DCMAKE_C_COMPILER="${{ inputs.CC }}" \
|
||||||
|
-DCMAKE_CXX_COMPILER="${{ inputs.CXX }}" \
|
||||||
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/env/dist" \
|
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/env/dist" \
|
||||||
-DAPPS_BUILD="all" \
|
-DAPPS_BUILD="all" \
|
||||||
-DTOOLS_BUILD=${{ inputs.tools }} \
|
-DTOOLS_BUILD=${{ inputs.tools }} \
|
||||||
@@ -116,8 +146,8 @@ runs:
|
|||||||
-DCMAKE_BUILD_TYPE="Release" \
|
-DCMAKE_BUILD_TYPE="Release" \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
|
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
|
||||||
-DCMAKE_C_FLAGS="-Werror ${{ startsWith(inputs.cc, 'clang') && '-ferror-limit=' || '-fmax-errors=' }}${{inputs.maxerrors}} " \
|
-DCMAKE_C_FLAGS="-Werror ${{ startsWith(inputs.CC, 'clang') && '-ferror-limit=' || '-fmax-errors=' }}${{inputs.maxerrors}} -fdebug-prefix-map=${GITHUB_WORKSPACE}=." \
|
||||||
-DCMAKE_CXX_FLAGS="-Werror ${{ startsWith(inputs.cxx, 'clang') && '-ferror-limit=' || '-fmax-errors=' }}${{inputs.maxerrors}}" \
|
-DCMAKE_CXX_FLAGS="-Werror ${{ startsWith(inputs.CXX, 'clang') && '-ferror-limit=' || '-fmax-errors=' }}${{inputs.maxerrors}} -fdebug-prefix-map=${GITHUB_WORKSPACE}=." \
|
||||||
-DBUILD_TESTING="ON" \
|
-DBUILD_TESTING="ON" \
|
||||||
-DUSE_SCRIPTPCH=${{ inputs.pch == 'true' && 'ON' || '' }} \
|
-DUSE_SCRIPTPCH=${{ inputs.pch == 'true' && 'ON' || '' }} \
|
||||||
-DUSE_COREPCH=${{ inputs.pch == 'true' && 'ON' || '' }} \
|
-DUSE_COREPCH=${{ inputs.pch == 'true' && 'ON' || '' }} \
|
||||||
@@ -190,3 +220,7 @@ runs:
|
|||||||
else
|
else
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: ccache stats
|
||||||
|
shell: bash
|
||||||
|
run: ccache -s || true
|
||||||
|
|||||||
6
.github/workflows/core-build-nopch.yml
vendored
6
.github/workflows/core-build-nopch.yml
vendored
@@ -10,9 +10,13 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
6
.github/workflows/core-build-pch.yml
vendored
6
.github/workflows/core-build-pch.yml
vendored
@@ -10,9 +10,13 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
6
.github/workflows/core_modules_build.yml
vendored
6
.github/workflows/core_modules_build.yml
vendored
@@ -19,8 +19,12 @@ on:
|
|||||||
- 'src/server/shared/**/*'
|
- 'src/server/shared/**/*'
|
||||||
- 'src/tools/**/*'
|
- 'src/tools/**/*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/dashboard-ci.yml
vendored
2
.github/workflows/dashboard-ci.yml
vendored
@@ -16,7 +16,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
4
.github/workflows/docker_build.yml
vendored
4
.github/workflows/docker_build.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -115,6 +115,6 @@ jobs:
|
|||||||
event-type: azerothcore-new-images
|
event-type: azerothcore-new-images
|
||||||
client-payload: >
|
client-payload: >
|
||||||
{
|
{
|
||||||
"ref": "${{ github.ref }}",
|
"ref": "${{ github.ref_name }}",
|
||||||
"sha": "${{ github.sha }}"
|
"sha": "${{ github.sha }}"
|
||||||
}
|
}
|
||||||
|
|||||||
16
.github/workflows/macos_build.yml
vendored
16
.github/workflows/macos_build.yml
vendored
@@ -9,9 +9,13 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
macos-build:
|
macos-build:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -31,13 +35,19 @@ 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 }}:${{ github.sha }}
|
key: ccache:${{ matrix.os }}:${{ github.ref_name }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ccache:${{ matrix.os }}:${{ github.ref }}
|
ccache:${{ matrix.os }}:${{ github.ref_name }}
|
||||||
ccache:${{ matrix.os }}
|
ccache:${{ matrix.os }}
|
||||||
|
- name: reset ccache stats
|
||||||
|
shell: bash
|
||||||
|
run: ccache -z || true
|
||||||
- name: Install latest bash
|
- name: Install latest bash
|
||||||
run: brew install bash
|
run: brew install bash
|
||||||
- name: Configure OS
|
- name: Configure OS
|
||||||
run: source ./acore.sh install-deps
|
run: source ./acore.sh install-deps
|
||||||
- name: Build
|
- name: Build
|
||||||
run: source ./apps/ci/mac/ci-compile.sh
|
run: source ./apps/ci/mac/ci-compile.sh
|
||||||
|
- name: ccache stats
|
||||||
|
shell: bash
|
||||||
|
run: ccache -s || true
|
||||||
|
|||||||
2
.github/workflows/tools_build.yml
vendored
2
.github/workflows/tools_build.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/windows_build.yml
vendored
2
.github/workflows/windows_build.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
Reference in New Issue
Block a user