Compare commits

...

6 Commits

Author SHA1 Message Date
tequ
063ce3eaef use cp 2025-11-28 14:22:32 +09:00
tequ
2000c514a4 . 2025-11-28 14:18:47 +09:00
tequ
d4f4c2bc6c use apt cache 2025-11-28 13:59:27 +09:00
tequ
1b86cdc256 fix 2025-11-28 13:36:01 +09:00
tequ
01bacf90a6 remove --privileged flag 2025-11-28 13:13:41 +09:00
tequ
2162674931 rename cache_enabled to gha_cache_enabled 2025-11-28 13:13:14 +09:00
3 changed files with 41 additions and 16 deletions

View File

@@ -28,8 +28,8 @@ inputs:
description: 'Cache version for invalidation'
required: false
default: '1'
cache_enabled:
description: 'Whether to use cache'
gha_cache_enabled:
description: 'Whether to use actions/cache (disable for self-hosted with volume mounts)'
required: false
default: 'true'
ccache_enabled:
@@ -76,7 +76,7 @@ runs:
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
- name: Restore ccache directory for main branch
if: inputs.cache_enabled == 'true' && inputs.ccache_enabled == 'true'
if: inputs.gha_cache_enabled == 'true' && inputs.ccache_enabled == 'true'
id: ccache-restore
uses: ./.github/actions/xahau-ga-cache-restore
with:
@@ -88,7 +88,7 @@ runs:
cache-type: ccache-main
- name: Restore ccache directory for current branch
if: inputs.cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name != inputs.main_branch
if: inputs.gha_cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name != inputs.main_branch
id: ccache-restore-current-branch
uses: ./.github/actions/xahau-ga-cache-restore
with:
@@ -246,14 +246,14 @@ runs:
run: ccache -s
- name: Save ccache directory for main branch
if: success() && inputs.cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name == inputs.main_branch
if: success() && inputs.gha_cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name == inputs.main_branch
uses: actions/cache/save@v4
with:
path: ~/.ccache-main
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
- name: Save ccache directory for current branch
if: success() && inputs.cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name != inputs.main_branch
if: success() && inputs.gha_cache_enabled == 'true' && inputs.ccache_enabled == 'true' && steps.safe-branch.outputs.name != inputs.main_branch
uses: actions/cache/save@v4
with:
path: ~/.ccache-current

View File

@@ -17,8 +17,8 @@ inputs:
description: 'Cache version for invalidation'
required: false
default: '1'
cache_enabled:
description: 'Whether to use caching'
gha_cache_enabled:
description: 'Whether to use actions/cache (disable for self-hosted with volume mounts)'
required: false
default: 'true'
main_branch:
@@ -64,7 +64,7 @@ runs:
using: 'composite'
steps:
- name: Restore Conan cache
if: inputs.cache_enabled == 'true'
if: inputs.gha_cache_enabled == 'true'
id: cache-restore-conan
uses: ./.github/actions/xahau-ga-cache-restore
with:
@@ -77,7 +77,7 @@ runs:
cache-type: Conan
- name: Configure Conan cache paths
if: inputs.cache_enabled == 'false'
if: inputs.gha_cache_enabled == 'false'
shell: bash
# For self-hosted runners, register cache paths to be used as volumes
# This allows the cache to be shared between containers
@@ -163,7 +163,7 @@ runs:
..
- name: Save Conan cache
if: success() && inputs.cache_enabled == 'true' && steps.cache-restore-conan.outputs.cache-hit != 'true'
if: success() && inputs.gha_cache_enabled == 'true' && steps.cache-restore-conan.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.conan2

View File

@@ -174,8 +174,23 @@ jobs:
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f"matrix={output}\n")
apt-cache:
runs-on: [self-hosted, generic, 20.04]
container:
image: ubuntu:24.04
volumes:
- /home/runner/.apt-cache:/var/cache/apt
steps:
- name: Install build dependencies to save apt cache
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test -y
apt-get update
apt-get install -y python3 python-is-python3 pipx cmake ninja-build ccache perl libsqlite3-dev
build:
needs: matrix-setup
needs: [matrix-setup, apt-cache]
runs-on: [self-hosted, generic, 20.04]
container:
image: ubuntu:24.04
@@ -183,8 +198,8 @@ jobs:
- /home/runner/.conan-cache:/.conan-cache
- /home/runner/.ccache-main:/github/home/.ccache-main
- /home/runner/.ccache-current:/github/home/.ccache-current
options: >-
--privileged
# apt cache as readonly
- /home/runner/.apt-cache:/apt-cache-ro:ro
defaults:
run:
shell: bash
@@ -202,8 +217,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Seed apt cache
run: |
# prepare apt cache directory
mkdir -p /var/cache/apt/archives
# copy existing .deb files from apt cache
mkdir -p /var/cache/apt/archives
cp -a /apt-cache-ro/archives/. /var/cache/apt/archives/
- name: Install build dependencies
run: |
# install dependencies from apt cache
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test -y
@@ -312,7 +337,7 @@ jobs:
cc: ${{ matrix.cc }}
cxx: ${{ matrix.cxx }}
stdlib: ${{ matrix.stdlib }}
cache_enabled: 'false' # Disable caching for self hosted runner
gha_cache_enabled: 'false' # Disable caching for self hosted runner
- name: Build
uses: ./.github/actions/xahau-ga-build
@@ -327,7 +352,7 @@ jobs:
main_branch: ${{ env.MAIN_BRANCH_NAME }}
stdlib: ${{ matrix.stdlib }}
clang_gcc_toolchain: ${{ matrix.clang_gcc_toolchain || '' }}
cache_enabled: 'false' # Disable caching for self hosted runner
gha_cache_enabled: 'false' # Disable caching for self hosted runner
ccache_max_size: '100G'
- name: Set artifact name