Skip to content

Commit c6f95df

Browse files
authored
[actions] ccache in more places (#7851)
#changelog #ccache
1 parent 9ce54cc commit c6f95df

22 files changed

Lines changed: 94 additions & 143 deletions

.github/workflows/build-ios-tvos.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: build-ios-tvos
22

3-
43
# make the action not run on the local repo if the branch is also in a pull request to OF/OF
54
on:
65
push:
@@ -14,13 +13,15 @@ on:
1413
- '**/*.md'
1514
- 'examples/**'
1615

16+
env:
17+
ccache: ccache
1718

1819
concurrency:
1920
group: ${{ github.workflow }}-${{ github.ref }}
2021
cancel-in-progress: true
2122

2223
jobs:
23-
build-osx:
24+
build-ios-tvos:
2425
runs-on: macos-12
2526
strategy:
2627
matrix:

.github/workflows/build-linux-arm.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ on:
1212
paths-ignore:
1313
- '**/*.md'
1414
- 'examples/**'
15-
15+
16+
env:
17+
ccache: ccache
18+
1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
1821
cancel-in-progress: true
1922

2023
jobs:
21-
build-linux-platforms:
24+
build-linux-arm-platforms:
2225
runs-on: ubuntu-latest
2326
strategy:
2427
matrix:
@@ -35,6 +38,11 @@ jobs:
3538
version: 1.0
3639

3740
- uses: actions/checkout@v4
41+
- name: ccache
42+
uses: hendrikmuhs/ccache-action@v1.2.11
43+
with:
44+
# key: ${{ matrix.os }}-${{ matrix.type }}
45+
key: ${{ matrix.cfg.target }}
3846
- name: Download libs
3947
run: ./scripts/linux/download_libs.sh -a ${{matrix.cfg.libs}};
4048
- name: Install dependencies
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ on:
1313
- '**/*.md'
1414
- 'examples/**'
1515

16+
env:
17+
ccache: ccache
1618

1719
concurrency:
1820
group: ${{ github.workflow }}-${{ github.ref }}
1921
cancel-in-progress: true
2022

2123
jobs:
22-
build-linux-platforms:
24+
build-linux64-platforms:
2325
runs-on: ubuntu-latest
2426
strategy:
2527
matrix:
@@ -32,21 +34,25 @@ jobs:
3234
run: if [ "$TARGET" = "linux64" ]; then
3335
sudo apt-get remove libunwind-14 -y;
3436
fi
35-
3637
- name: Cache Packages
3738
uses: awalsh128/cache-apt-pkgs-action@latest
3839
with:
3940
packages: make curl libunwind-dev libjack-jackd2-0 libjack-jackd2-dev freeglut3-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile1-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libgtk2.0-dev libopencv-dev libassimp-dev librtaudio-dev gdb libglfw3-dev liburiparser-dev libcurl4-openssl-dev libpugixml-dev libgconf-2-4 libgtk2.0-0 libpoco-dev libxcursor-dev libxi-dev libxinerama-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav gstreamer1.0-pulseaudio gstreamer1.0-x gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good
4041
version: 1.0
4142

4243
- uses: actions/checkout@v4
44+
- name: ccache
45+
uses: hendrikmuhs/ccache-action@v1.2.11
46+
with:
47+
key: ${{ matrix.cfg.target }}-${{ matrix.cfg.libs }}
48+
4349
- name: Download libs
4450
run: ./scripts/linux/download_libs.sh -a ${{matrix.cfg.libs}};
4551
- name: Install dependencies
4652
run: ./scripts/ci/$TARGET/install.sh;
4753
- name: Build
4854
run: if [ "$TARGET" = "linux64" ]; then
49-
scripts/ci/$TARGET/build.sh;
55+
scripts/ci/linux64/build.sh;
5056
scripts/ci/$TARGET/run_tests.sh;
5157
else
5258
scripts/ci/$TARGET/build.sh;

.github/workflows/build-macos.yml

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,34 @@ on:
1313
- '**/*.md'
1414
- 'examples/**'
1515

16+
env:
17+
ccache: ccache
18+
1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
1821
cancel-in-progress: true
1922

2023
jobs:
21-
build-osx:
22-
runs-on: macos-12
24+
build-macos:
25+
runs-on: macos-13
2326
strategy:
2427
matrix:
2528
cfg:
2629
- {target: osx, opt: "xcode"}
2730
- {target: osx, opt: "makefiles"}
28-
env:
29-
TARGET: ${{matrix.cfg.target}}
30-
OPT: ${{matrix.cfg.opt}}
3131
steps:
3232
- uses: actions/checkout@v4
33-
# - name: Cache compile
34-
# id: cache-compile
35-
# uses: actions/cache@v3
36-
# env:
37-
# cache-name: cache-keep-compile
38-
# with:
39-
# path: |
40-
# libs/openFrameworksCompiled/lib/osx/**/
41-
# addons/obj/osx/**/
42-
#
43-
# # key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-${{ hashFiles('**/*.cpp') }}
44-
# key: ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
45-
# restore-keys: |
46-
# ${{ runner.os }}-${{matrix.cfg.opt}}-${{ env.cache-name }}-
33+
- name: ccache
34+
uses: hendrikmuhs/ccache-action@v1.2.11
35+
with:
36+
# key: ${{ matrix.os }}-${{ matrix.type }}
37+
key: ${{ matrix.cfg.target }}-${{ matrix.cfg.opt }}
38+
# key: ${{ matrix.msystem }}
39+
4740

48-
# - name: Cache libs
49-
# id: cache-libs
50-
# uses: actions/cache@v3
51-
# env:
52-
# cache-name: cache-install-libs
53-
# with:
54-
# path: |
55-
# libs/boost/**
56-
# libs/cairo/**
57-
# libs/curl/**
58-
# libs/fmod/**
59-
# libs/FreeImage/**
60-
# libs/freetype/**
61-
# libs/glew/**
62-
# libs/glfw/**
63-
# libs/glm/**
64-
# libs/json/**
65-
# libs/pugixml/**
66-
# libs/rtAudio/**
67-
# libs/tess2/**
68-
# libs/uriparser/**
69-
# libs/utf8/**
70-
# addons/ofxAssimpModelLoader/libs/**/
71-
# addons/ofxKinect/libs/**/
72-
# addons/ofxOpenCv/libs/**/
73-
# addons/ofxSvg/libs/**/
74-
# addons/ofxPoco/libs/**/
75-
#
76-
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('scripts/apothecary/apothecary/formulas/**/*.sh') }}
77-
# restore-keys: |
78-
# ${{ runner.os }}-build-${{ env.cache-name }}-
79-
# - if: ${{ steps.cache-libs.outputs.cache-hit != 'true' }}
8041
- name: Download libs
8142
# continue-on-error: true
82-
run: ./scripts/$TARGET/download_libs.sh
43+
run: ./scripts/${{ matrix.cfg.target }}/download_libs.sh
8344
# - name: rm-dev
8445
# run: sudo rm -rf /Library/Developer
8546

@@ -89,10 +50,10 @@ jobs:
8950

9051
- name: Build
9152
run:
92-
if [ "$OPT" = "xcode" ]; then
93-
scripts/ci/$TARGET/build.sh $OPT;
53+
if [ ${{ matrix.cfg.opt }} = "xcode" ]; then
54+
scripts/ci/${{ matrix.cfg.target }}/build.sh ${{ matrix.cfg.opt }};
9455
else
95-
scripts/ci/$TARGET/run_tests.sh;
56+
scripts/ci/${{ matrix.cfg.target }}/run_tests.sh;
9657
fi
9758
env:
9859
DEVELOPER_DIR: "/Applications/Xcode.app/Contents/Developer"

.github/workflows/build-msys2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- 'examples/**'
1515

1616
env:
17-
USE_CCACHE: USE_CCACHE=1
17+
ccache: ccache
1818

1919
concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/build-vs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
- '**/*.md'
1414
- 'examples/**'
1515

16+
env:
17+
ccache: ccache
18+
1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
1821
cancel-in-progress: true

.github/workflows/manual-nightly.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
matrix:
1515
cfg:
1616
- {target: linux64, libs: 64gcc6}
17-
env:
18-
TARGET: ${{matrix.cfg.target}}
1917
steps:
2018
- name: Install libunwind
2119
run: sudo apt-get install libunwind-dev
@@ -28,7 +26,7 @@ jobs:
2826

2927
- uses: actions/checkout@v4
3028
- name: Install dependencies
31-
run: ./scripts/ci/$TARGET/install.sh;
29+
run: ./scripts/ci/${{matrix.cfg.target}}/install.sh;
3230
- name: Download libs
3331
run: ./scripts/linux/download_libs.sh -a ${{matrix.cfg.libs}};
3432
- name: Create Package
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: "0 6 * * *"
66
jobs:
7-
build-linux-platforms:
7+
build-nightly:
88
runs-on: ubuntu-latest
99
if: github.repository == 'openframeworks/openFrameworks' && github.ref == 'refs/heads/master'
1010
strategy:

libs/openFrameworksCompiled/project/makefileCommon/compile.core.mk

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
################################################################################
44
ifdef MAKEFILE_DEBUG
5-
$(info ===================compile.core.make================================)
5+
$(info ===================compile.core.make================================)
66
endif
77

88
ifdef PROJECT_CXX
@@ -35,6 +35,12 @@ else
3535
ARFLAGS = -cr
3636
endif
3737

38+
ifdef ${ccache}
39+
$(info 💿 Using CCACHE - Compile.core.mk )
40+
CXX := ${ccache} $(CXX)
41+
CC := ${ccache} $(CXX)
42+
endif
43+
3844
################################################################################
3945
# CFLAGS
4046
################################################################################
@@ -181,14 +187,14 @@ OF_CORE_OBJ_FILES = $(addprefix $(OF_CORE_OBJ_OUTPUT_PATH),$(patsubst $(OF_ROOT)
181187
# DEBUG INFO
182188
################################################################################
183189
ifdef MAKEFILE_DEBUG
184-
$(info ========================= compile.core.make flags ========================)
185-
$(info OF_CORE_OBJ_OUTPUT_PATH=$(OF_CORE_OBJ_OUTPUT_PATH))
190+
$(info ========================= compile.core.make flags ========================)
191+
$(info OF_CORE_OBJ_OUTPUT_PATH=$(OF_CORE_OBJ_OUTPUT_PATH))
186192

187-
$(info ---OF_CORE_DEPENDENCY_FILES---)
188-
$(foreach v, $(OF_CORE_DEPENDENCY_FILES),$(info $(v)))
193+
$(info ---OF_CORE_DEPENDENCY_FILES---)
194+
$(foreach v, $(OF_CORE_DEPENDENCY_FILES),$(info $(v)))
189195

190-
$(info ---OF_CORE_OBJ_FILES---)
191-
$(foreach v, $(OF_CORE_OBJ_FILES),$(info $(v)))
196+
$(info ---OF_CORE_OBJ_FILES---)
197+
$(foreach v, $(OF_CORE_OBJ_FILES),$(info $(v)))
192198
endif
193199

194200

libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ endif
122122

123123
Release:
124124
@echo Compiling OF library for Release
125-
@$(MAKE) -C $(OF_ROOT)/libs/openFrameworksCompiled/project/ Release PLATFORM_OS=$(PLATFORM_OS) ABIS_TO_COMPILE_RELEASE="$(ABIS_TO_COMPILE_RELEASE)"
125+
@$(MAKE) -j -C $(OF_ROOT)/libs/openFrameworksCompiled/project/ Release PLATFORM_OS=$(PLATFORM_OS) ABIS_TO_COMPILE_RELEASE="$(ABIS_TO_COMPILE_RELEASE)"
126126
@echo
127127
@echo
128128
@echo Compiling $(APPNAME) for Release
129129
ifndef ABIS_TO_COMPILE_RELEASE
130-
@$(MAKE) ReleaseABI
130+
@$(MAKE) -j ReleaseABI
131131
else
132132
@$(foreach abi,$(ABIS_TO_COMPILE_RELEASE),$(MAKE) ReleaseABI ABI=$(abi) &&) echo
133133
endif
@@ -141,43 +141,43 @@ Debug:
141141
@echo
142142
@echo Compiling $(APPNAME) for Debug
143143
ifndef ABIS_TO_COMPILE_DEBUG
144-
@$(MAKE) DebugABI
144+
@$(MAKE) -j DebugABI
145145
else
146146
@$(foreach abi,$(ABIS_TO_COMPILE_DEBUG),$(MAKE) DebugABI ABI=$(abi) &&) echo
147147
endif
148148

149149
ReleaseNoOF:
150150
@echo Compiling $(APPNAME) for Release
151151
ifndef ABIS_TO_COMPILE_RELEASE
152-
@$(MAKE) ReleaseABI
152+
@$(MAKE) -j ReleaseABI
153153
else
154154
@$(foreach abi,$(ABIS_TO_COMPILE_RELEASE),$(MAKE) ReleaseABI ABI=$(abi) &&) echo
155155
endif
156156

157157
DebugNoOF:
158158
@echo Compiling $(APPNAME) for Debug
159159
ifndef ABIS_TO_COMPILE_DEBUG
160-
@$(MAKE) DebugABI
160+
@$(MAKE) -j DebugABI
161161
else
162162
@$(foreach abi,$(ABIS_TO_COMPILE_DEBUG),$(MAKE) DebugABI ABI=$(abi) &&) echo
163163
endif
164164

165165
ReleaseABI: $(TARGET)
166166
ifneq ($(strip $(PROJECT_ADDONS_DATA)),)
167-
@$(MAKE) copyaddonsdata PROJECT_ADDONS_DATA="$(PROJECT_ADDONS_DATA)"
167+
@$(MAKE) -j copyaddonsdata PROJECT_ADDONS_DATA="$(PROJECT_ADDONS_DATA)"
168168
endif
169-
@$(MAKE) afterplatform BIN_NAME=$(BIN_NAME) ABIS_TO_COMPILE="$(ABIS_TO_COMPILE_RELEASE)" RUN_TARGET=$(RUN_TARGET) TARGET=$(TARGET)
169+
@$(MAKE) -j afterplatform BIN_NAME=$(BIN_NAME) ABIS_TO_COMPILE="$(ABIS_TO_COMPILE_RELEASE)" RUN_TARGET=$(RUN_TARGET) TARGET=$(TARGET)
170170
@$(PROJECT_AFTER)
171171

172172
DebugABI: $(TARGET)
173173
ifneq ($(strip $(PROJECT_ADDONS_DATA)),)
174-
@$(MAKE) copyaddonsdata PROJECT_ADDONS_DATA="$(PROJECT_ADDONS_DATA)"
174+
@$(MAKE) -j copyaddonsdata PROJECT_ADDONS_DATA="$(PROJECT_ADDONS_DATA)"
175175
endif
176-
@$(MAKE) afterplatform BIN_NAME=$(BIN_NAME) ABIS_TO_COMPILE="$(ABIS_TO_COMPILE_DEBUG)" RUN_TARGET=$(RUN_TARGET) TARGET=$(TARGET)
176+
@$(MAKE) -j afterplatform BIN_NAME=$(BIN_NAME) ABIS_TO_COMPILE="$(ABIS_TO_COMPILE_DEBUG)" RUN_TARGET=$(RUN_TARGET) TARGET=$(TARGET)
177177
@$(PROJECT_AFTER)
178178

179179
all:
180-
$(MAKE) Debug
180+
$(MAKE) -j Debug
181181

182182
run:
183183
ifeq ($(PLATFORM_RUN_COMMAND),)

0 commit comments

Comments
 (0)