Skip to content

Commit f970efc

Browse files
author
codethinki
committed
now with build cache and proper vcpkg access in the linux container
1 parent effad0a commit f970efc

File tree

6 files changed

+99
-42
lines changed

6 files changed

+99
-42
lines changed

.github/actions/run-linux/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ runs:
1818
-e BUILDCACHE_DIR=/work/.buildcache
1919
-e ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}
2020
-e ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}
21+
-v ${{ env.VCPKG_INSTALLATION_ROOT }}:/vcpkg
22+
-e VCPKG_ROOT=/vcpkg
2123
run: ${{ inputs.run }}

.github/actions/setup-linux/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: 'Setup Linux Environment'
22
description: 'Restores caches for Linux runtime'
33

4+
inputs:
5+
compiler:
6+
description: 'Compiler to use for cache key'
7+
required: false
8+
default: 'unknown'
9+
410
runs:
511
using: "composite"
612
steps:
@@ -19,9 +25,9 @@ runs:
1925
uses: actions/cache@v4
2026
with:
2127
path: .buildcache
22-
key: buildcache-linux-${{ github.sha }}
28+
key: buildcache-linux-${{ inputs.compiler }}-${{ github.sha }}
2329
restore-keys: |
24-
buildcache-linux-
30+
buildcache-linux-${{ inputs.compiler }}-
2531
2632
- name: Export GitHub Actions Cache Environment
2733
uses: actions/github-script@v7

.github/workflows/ci.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ jobs:
4141

4242
- name: Setup Linux Env
4343
uses: ./.github/actions/setup-linux
44+
with:
45+
compiler: ${{ matrix.compiler }}
4446

4547
# Vcpkg cache
4648
- name: Cache vcpkg installed
4749
uses: actions/cache@v4
4850
with:
4951
path: |
50-
out/build/base/vcpkg_installed
52+
vcpkg_installed
5153
key: vcpkg-installed-linux-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }}
5254
restore-keys: |
5355
vcpkg-installed-linux-${{ matrix.compiler }}-
@@ -57,9 +59,7 @@ jobs:
5759
with:
5860
run: |
5961
cp ci/CMakeUserPresets.json CMakeUserPresets.json
60-
cmake --preset ${{ matrix.compiler }}_af_cpu \
61-
-DFL_BUILD_TESTS=ON \
62-
-DFL_BUILD_STANDALONE=ON
62+
cmake --preset ci_${{ matrix.compiler }}_af_cpu
6363
6464
- name: Build
6565
uses: ./.github/actions/run-linux
@@ -69,7 +69,7 @@ jobs:
6969
- name: Test
7070
uses: ./.github/actions/run-linux
7171
with:
72-
run: ctest --test-dir out/build/${{ matrix.compiler }}_af_cpu -C Release --output-on-failure
72+
run: ctest --test-dir out/build/ci_${{ matrix.compiler }}_af_cpu -C Release --output-on-failure
7373

7474
- name: Fix permissions
7575
if: always()
@@ -120,9 +120,7 @@ jobs:
120120
shell: pwsh
121121
run: |
122122
Copy-Item ci/CMakeUserPresets.json CMakeUserPresets.json
123-
cmake --preset msvc_af_cpu `
124-
-DFL_BUILD_TESTS=ON `
125-
-DFL_BUILD_STANDALONE=ON
123+
cmake --preset ci_msvc_af_cpu
126124
127125
- name: Build
128126
shell: pwsh
@@ -132,4 +130,4 @@ jobs:
132130
- name: Test
133131
shell: pwsh
134132
run: |
135-
ctest --test-dir out/build/msvc_af_cpu -C Release --output-on-failure
133+
ctest --test-dir out/build/ci_msvc_af_cpu -C Release --output-on-failure

CMakePresets.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
"hidden": true,
3232
"generator": "Ninja Multi-Config"
3333
},
34+
{
35+
"name" : "build-cache",
36+
"hidden": true,
37+
"cacheVariables": {
38+
"CMAKE_CXX_COMPILER_LAUNCHER": "BuildCache"
39+
}
40+
},
3441
{
3542
"name": "base",
3643
"hidden": true,

ci/CMakeUserPresets.json

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,71 @@
11
{
2-
"version": 3,
3-
4-
"buildPresets": [
5-
{
6-
"name": "ci-base",
7-
"hidden": true,
8-
"configuration": "Release"
9-
},
10-
{
11-
"name": "win_msvc_af_cpu_ci_build_test",
12-
"configurePreset": "msvc_af_cpu",
13-
"inherits": "ci-base"
14-
15-
},
16-
{
17-
"name": "win_msvc_af_cuda_ci_build",
18-
"configurePreset": "msvc_af_cuda",
19-
"inherits": "ci-base"
20-
},
21-
{
22-
"name": "linux_gcc_af_cpu_ci_build_test",
23-
"configurePreset": "gcc_af_cpu",
24-
"inherits": "ci-base"
25-
26-
},
27-
{
28-
"name": "linux_gcc_af_cuda_ci_build",
29-
"configurePreset": "gcc_af_cuda",
30-
"inherits": "ci-base"
31-
}
32-
]
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "ci-config-base",
6+
"hidden": true,
7+
"inherits": [
8+
"build-cache"
9+
],
10+
"cacheVariables": {
11+
"FL_BUILD_TESTS": "ON",
12+
"FL_BUILD_STANDALONE": "ON"
13+
}
14+
},
15+
{
16+
"name": "ci_msvc_af_cpu",
17+
"inherits": [
18+
"ci-config-base",
19+
"msvc_af_cpu"
20+
]
21+
},
22+
{
23+
"name": "ci_msvc_af_cuda",
24+
"inherits": [
25+
"ci-config-base",
26+
"msvc_af_cuda"
27+
]
28+
},
29+
{
30+
"name": "ci_gcc_af_cpu",
31+
"inherits": [
32+
"ci-config-base",
33+
"gcc_af_cpu"
34+
]
35+
},
36+
{
37+
"name": "ci_gcc_af_cuda",
38+
"inherits": [
39+
"ci-config-base",
40+
"gcc_af_cuda"
41+
]
42+
}
43+
],
44+
"buildPresets": [
45+
{
46+
"name": "ci-build-base",
47+
"hidden": true,
48+
"configuration": "Release"
49+
},
50+
{
51+
"name": "win_msvc_af_cpu_ci_build_test",
52+
"configurePreset": "ci_msvc_af_cpu",
53+
"inherits": "ci-build-base"
54+
},
55+
{
56+
"name": "win_msvc_af_cuda_ci_build",
57+
"configurePreset": "ci_msvc_af_cuda",
58+
"inherits": "ci-build-base"
59+
},
60+
{
61+
"name": "linux_gcc_af_cpu_ci_build_test",
62+
"configurePreset": "ci_gcc_af_cpu",
63+
"inherits": "ci-build-base"
64+
},
65+
{
66+
"name": "linux_gcc_af_cuda_ci_build",
67+
"configurePreset": "ci_gcc_af_cuda",
68+
"inherits": "ci-build-base"
69+
}
70+
]
3371
}

ci/docker/linux/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ RUN pacman -Syu --noconfirm && \
1717
wget \
1818
cloc
1919

20+
# Install buildcache
21+
RUN wget -nv https://github.com/lucasg/buildcache/releases/download/v0.28.4/buildcache-linux-x86_64.tar.gz && \
22+
tar -xzf buildcache-linux-x86_64.tar.gz && \
23+
mv buildcache/bin/buildcache /usr/local/bin/ && \
24+
rm -rf buildcache*
25+
2026
ENV VCPKG_ROOT=/opt/vcpkg
2127

2228
# Install ArrayFire from script

0 commit comments

Comments
 (0)