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

cache ci #138

Merged
merged 30 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ff91dc4
cache correct .ccache path
wang-edward Dec 31, 2024
a96cd76
check if ~/.ccache is there
wang-edward Dec 31, 2024
3b3b6f9
set ccache in CMakeLists
wang-edward Dec 31, 2024
45c8e13
i think it's in ~/.config/ccache
wang-edward Dec 31, 2024
15a0506
print more
wang-edward Dec 31, 2024
3e956ff
try set path = .config/ccache
wang-edward Dec 31, 2024
1fcdc37
set CCACHE_DIR env
wang-edward Dec 31, 2024
e8d11ea
fix path and more prints
wang-edward Dec 31, 2024
caa87e6
more print
wang-edward Dec 31, 2024
8db030d
more print
wang-edward Dec 31, 2024
87e6184
set _DCMAKE_C_COMPILER_LAUNCHER
wang-edward Dec 31, 2024
0273dff
remove find
wang-edward Dec 31, 2024
ddfaac5
try to see where (default) cache_dir is
wang-edward Dec 31, 2024
647214f
try /home/runner/.ccache
wang-edward Dec 31, 2024
19a33a2
hello.c example
wang-edward Dec 31, 2024
6030fda
try no CC and space after -D
wang-edward Dec 31, 2024
2403a9f
try a different build method
wang-edward Dec 31, 2024
e623936
build no cmake
wang-edward Dec 31, 2024
629fa69
make home dir
wang-edward Dec 31, 2024
f33dcb0
find cache
wang-edward Dec 31, 2024
11e5be8
remove non-cmake build
wang-edward Dec 31, 2024
a7a900b
Build (ci way)
wang-edward Dec 31, 2024
567192c
go back to old cmakelists
wang-edward Dec 31, 2024
d25b109
cleanup test to test caching
wang-edward Dec 31, 2024
6b4d977
delete prints
wang-edward Dec 31, 2024
b10e753
formatting
wang-edward Dec 31, 2024
36eb085
try using CC instead of -D
wang-edward Dec 31, 2024
bc71205
Revert "try using CC instead of -D"
wang-edward Dec 31, 2024
fab01a3
delete test files
wang-edward Dec 31, 2024
45dbe30
delete ccache from local CMakeLists
wang-edward Dec 31, 2024
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
26 changes: 9 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: test

env:
CC: "ccache clang"
CXX: "ccache clang++"
DOWNLOAD_CACHE_VERSION: 8

on:
# don't run on push to main cuz i do that a lot
push:
branches: [ "main" ]
pull_request:
Expand Down Expand Up @@ -36,7 +31,6 @@ jobs:
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -46,39 +40,37 @@ jobs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt-get install -y tree ccache gcc-11 g++-11 freeglut3-dev g++ libasound2-dev libcurl4-openssl-dev libfreetype6-dev libjack-jackd2-dev libx11-dev libxcomposite-dev libxcursor-dev libxinerama-dev libxrandr-dev mesa-common-dev ladspa-sdk webkit2gtk-4.0 libgtk-3-dev xvfb ninja-build libwebkit2gtk-4.1-dev

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Make cache dir
run: mkdir /home/runner/.ccache
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: .ccache
path: /home/runner/.ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.DOWNLOAD_CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-ccache-

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-S ${{ github.workspace }}

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel $(nproc)

- name: Verify cache
run : ls -a
- name: Verify cache 2
run : tree ~
- name: Print ccache stats
run: |
ccache -s
ccache -p

# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
# set(C_COMPILER_LAUNCHER ccache)
# set(CXX_COMPILER_LAUNCHER ccache)
project(BOX VERSION 0.0.1)

if (APPLE)
Expand Down
Loading