From aa20f384dcf06a7dbf9e35a5bcd28382e453dbea Mon Sep 17 00:00:00 2001 From: Fijxu Date: Thu, 14 Mar 2024 19:45:27 -0300 Subject: [PATCH] feature: Store CCACHE cache in CI Cache. --- .ci/scripts/linux/docker.sh | 7 +++++-- .gitignore | 4 ++++ .gitlab-ci.yml | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh index 7a734a08d9..d3c8e9e3f8 100755 --- a/.ci/scripts/linux/docker.sh +++ b/.ci/scripts/linux/docker.sh @@ -1,4 +1,5 @@ #!/bin/bash -ex + # SPDX-FileCopyrightText: 2019 yuzu Emulator Project # SPDX-FileCopyrightText: 2024 suyu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later @@ -6,15 +7,16 @@ # Exit on error, rather than continuing with the rest of the script. set -e +# Old versions of ccache don't include the -v argument. Keep it only with -s ccache -s mkdir build || true && cd build cmake .. \ -DBoost_USE_STATIC_LIBS=ON \ + -DSUYU_USE_PRECOMPILED_HEADERS=OFF \ + -DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_FLAGS="-march=x86-64-v2" \ - -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \ - -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \ -DCMAKE_INSTALL_PREFIX="/usr" \ -DDISPLAY_VERSION=$1 \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \ @@ -24,6 +26,7 @@ cmake .. \ -DSUYU_USE_BUNDLED_FFMPEG=ON \ -DSUYU_ENABLE_LTO=ON \ -DSUYU_CRASH_DUMPS=ON \ + -DUSE_CCACHE=ON \ -GNinja ninja diff --git a/.gitignore b/.gitignore index 0e06e5aa00..fed38fa453 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,7 @@ Thumbs.db # Local Gitlab CI Runner .gitlab-ci-local/ + +# clangd compile_commands.json +# https://clangd.llvm.org/installation.html#project-setup +compile_commands.json \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f8113bfbf..e96bf21c29 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,21 @@ stages: - format - build + +variables: + # https://docs.gitlab.com/ee/ci/runners/configure_runners.html + TRANSFER_METER_FREQUENCY: "2s" + ARTIFACT_COMPRESSION_LEVEL: "fast" + CACHE_COMPRESSION_LEVEL: "fastest" + CACHE_REQUEST_TIMEOUT: 5 + # Use FASTZIP for faster compression in cache and artifacts + # https://docs.gitlab.com/runner/configuration/feature-flags.html#available-feature-flags + FF_USE_FASTZIP: true + + # Our Variables + CACHE_DIR: "$CI_PROJECT_DIR/ccache" + CCACHE_DIR: $CACHE_DIR + #CLANG FORMAT - CHECKS CODE FOR FORMATTING ISSUES clang-format: stage: format @@ -10,11 +25,19 @@ clang-format: script: - git submodule update --init --depth 1 --recursive - bash .ci/scripts/format/script.sh + #LINUX BUILD - BUILDS LINUX APPIMAGE build-linux: stage: build image: registry.gitlab.com/ddutchie/ci-docker:linux-x64 resource_group: linux-ci + cache: + key: "$CI_COMMIT_REF_NAME-ccache" + paths: + - $CACHE_DIR + before_script: + - mkdir -p $CACHE_DIR + - ls -la $CACHE_DIR variables: GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_DEPTH: 1 @@ -25,6 +48,7 @@ build-linux: artifacts: paths: - artifacts/* + #ANDROID BUILD - BUILDS APK android: stage: build @@ -39,3 +63,4 @@ android: artifacts: paths: - artifacts/* +