Skip to content

Commit cf9b88a

Browse files
committed
Implemented a github action step that pre-compiles all conan
dependencies and caches them for use in later builds, improving build speed. Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
1 parent ff10692 commit cf9b88a

7 files changed

Lines changed: 113 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ jobs:
7474
run: |
7575
uname -a
7676
77+
- uses: actions/cache/restore@v6
78+
name: restore conan cache
79+
id: cache
80+
with:
81+
path: ~/.conan2
82+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
83+
7784
- name: install packages
7885
run: |
7986
./tools/ci/retry.sh apt-get update

.github/workflows/controller.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
needs: hwsapibot
1616
if: ${{ !failure() && !cancelled() }}
1717
uses: ./.github/workflows/tools.yml
18+
tools-windows:
19+
needs: hwsapibot
20+
if: ${{ !failure() && !cancelled() }}
21+
uses: ./.github/workflows/tools-windows.yml
1822
build:
1923
needs: tools
2024
if: ${{ !failure() && !cancelled() }}
@@ -48,6 +52,6 @@ jobs:
4852
# if: ${{ !failure() && !cancelled() }}
4953
# uses: ./.github/workflows/macos_m1.yml
5054
windows:
51-
needs: tools
55+
needs: tools-windows
5256
if: ${{ !failure() && !cancelled() }}
5357
uses: ./.github/workflows/windows.yml

.github/workflows/mariadb.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ jobs:
6969
run: |
7070
uname -a
7171
72+
- uses: actions/cache/restore@v6
73+
name: restore conan cache
74+
id: cache
75+
with:
76+
path: ~/.conan2
77+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
78+
7279
- name: install packages
7380
run: |
7481
./tools/ci/retry.sh apt-get update

.github/workflows/sanitizer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ jobs:
7878
run: |
7979
uname -a
8080
81+
- uses: actions/cache/restore@v6
82+
name: restore conan cache
83+
id: cache
84+
with:
85+
path: ~/.conan2
86+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
87+
8188
- name: install packages
8289
run: |
8390
./tools/ci/retry.sh apt-get update
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: tools-windows
2+
3+
on: workflow_call
4+
5+
jobs:
6+
build:
7+
runs-on: windows-2025
8+
timeout-minutes: 30
9+
strategy:
10+
matrix:
11+
CC: [msvc]
12+
13+
# github.head_ref will stop previous runs in the same PR (if in a PR)
14+
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
15+
concurrency:
16+
group: tools-windows-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}
17+
cancel-in-progress: true
18+
19+
steps:
20+
- uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 1
23+
24+
- uses: actions/cache/restore@v6 # We're restoring first so if a cache already exists from previous CI run, it's used and step finishes quicker.
25+
name: restore conan cache
26+
id: cache-restore
27+
with:
28+
path: ~/.conan2
29+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
30+
31+
- name: run cmake first run
32+
if: steps.cache-restore.outputs.cache-hit != 'true'
33+
run: |
34+
./setup_env.ps1
35+
36+
- uses: actions/cache/save@v6
37+
if: steps.cache-restore.outputs.cache-hit != 'true'
38+
name: save conan cache
39+
id: cache_save
40+
with:
41+
path: ~/.conan2
42+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
43+

.github/workflows/tools.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@ env:
77
MYSQL_USER: 'ragnarok'
88
MYSQL_PASSWORD: 'ragnarok'
99
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
10-
DEBIAN_COMMON_PACKAGES: python3 python3-pip
10+
DEBIAN_COMMON_PACKAGES: python3 python3-pip python3-venv cmake make git gcc g++
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash
18+
strategy:
19+
matrix:
20+
CC: ["clang-21", "gcc-15"]
21+
include:
22+
- CXX: 'g++-15'
23+
CC: 'gcc-15'
24+
- CXX: 'clang++-21'
25+
CC: 'clang-21'
1526

1627
# github.head_ref will stop previous runs in the same PR (if in a PR)
1728
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
1829
concurrency:
19-
group: tools-${{ github.head_ref || github.run_id }}
30+
group: tools-linux-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}
2031
cancel-in-progress: true
2132

2233
container:
23-
image: debian:unstable
34+
image: ubuntu:26.04
2435
steps:
2536
- uses: actions/checkout@v6
2637
with:
@@ -33,9 +44,31 @@ jobs:
3344
- name: install packages
3445
run: |
3546
./tools/ci/retry.sh apt-get update
36-
./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES
47+
./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES ${{ matrix.CC }} ${{ matrix.CXX }}
3748
pip3 install sqlfluff --break-system-packages
3849
50+
- uses: actions/cache/restore@v6 # We're restoring first so if a cache already exists from previous CI run, it's used and step finishes quicker.
51+
name: restore conan cache
52+
id: cache-restore
53+
with:
54+
path: ~/.conan2
55+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
56+
57+
- name: run cmake first run
58+
if: steps.cache-restore.outputs.cache-hit != 'true'
59+
run: |
60+
./tools/ci/travis.sh prepareenv
61+
source .venv/bin/activate
62+
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake_modules/conan_provider.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }}
63+
64+
- uses: actions/cache/save@v6
65+
if: steps.cache-restore.outputs.cache-hit != 'true'
66+
name: save conan cache
67+
id: cache_save
68+
with:
69+
path: ~/.conan2
70+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
71+
3972
- name: check sql syntax
4073
run: |
4174
./tools/ci/retry.sh python3 tools/validate_sql-files.py

.github/workflows/windows.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ jobs:
4545
# run: |
4646
# winget install Ninja-build.Ninja cmake python3 --accept-source-agreements --accept-package-agreements --disable-interactivity --silent
4747

48+
- uses: actions/cache/restore@v6
49+
name: restore conan cache
50+
id: cache
51+
with:
52+
path: ~/.conan2
53+
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
54+
4855
- uses: shogo82148/actions-setup-mysql@v1
4956
with:
5057
distribution: "mariadb"

0 commit comments

Comments
 (0)