Skip to content

Commit

Permalink
Workflows: Caching (#134)
Browse files Browse the repository at this point in the history
* macOS: Xcode instead of Unix Makefiles

* Caching

* Report FetchContent Progress

* Save cache if it does not exist

* Caching in all builds
  • Loading branch information
jcrada committed Jan 18, 2024
1 parent 4cd9d59 commit 4e307ea
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 10 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/LinuxFullBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
Expand All @@ -42,6 +50,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/LinuxMediumBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/LinuxQuickBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
Expand All @@ -25,3 +33,13 @@ jobs:
cmake -B build/${{ matrix.build_type }} -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .
cmake --build build/${{ matrix.build_type }} --parallel
ctest --test-dir build/${{ matrix.build_type }}
ls -la build/${{ matrix.build_type }}
- name: Save cmake dependencies
if: steps.cache-restore-cmake-deps.outputs.cache-hit != 'true'
id: cache-save-cmake-deps
uses: actions/cache/save@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ steps.cache-restore-cmake-deps.outputs.cache-primary-key }}
46 changes: 44 additions & 2 deletions .github/workflows/MacFullBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ on:
branches: [ "build/*", "build-mac/*" ]

jobs:
build-xcode:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
use_cpp98: [ "OFF", "ON" ]
use_float: [ "OFF", "ON" ]

steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
run: |
cmake -B build/${{ matrix.build_type }} -G"Xcode" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFL_CPP98=${{ matrix.use_cpp98 }} -DFL_USE_FLOAT=${{ matrix.use_float }} .
cmake --build build/${{ matrix.build_type }} --parallel
ctest --test-dir build/${{ matrix.build_type }}
build-clang:
runs-on: macos-latest

Expand All @@ -18,10 +46,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
CXX: clang++
run: |
cmake -B build/${{ matrix.build_type }} -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFL_CPP98=${{ matrix.use_cpp98 }} -DFL_USE_FLOAT=${{ matrix.use_float }} .
cmake --build build/${{ matrix.build_type }} --parallel
Expand All @@ -41,6 +75,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/MacMediumBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ jobs:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
use_cxx: [ "clang++", "g++-13" ]
use_cpp98: [ "OFF", "ON" ]
use_float: [ "OFF", "ON" ]

steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
CXX: ${{ matrix.use_cxx }}
run: |
cmake -B build/${{ matrix.build_type }} -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFL_CPP98=${{ matrix.use_cpp98 }} -DFL_USE_FLOAT=${{ matrix.use_float }} .
cmake -B build/${{ matrix.build_type }} -G"Xcode" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DFL_CPP98=${{ matrix.use_cpp98 }} -DFL_USE_FLOAT=${{ matrix.use_float }} .
cmake --build build/${{ matrix.build_type }} --parallel
ctest --test-dir build/${{ matrix.build_type }}
23 changes: 19 additions & 4 deletions .github/workflows/MacQuickBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,31 @@ jobs:
fail-fast: false
matrix:
build_type: [ "release" ]
use_cxx: [ "clang++" ]

steps:
- uses: actions/checkout@v4

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
env:
CXX: ${{ matrix.use_cxx }}
run: |
cmake -B build/${{ matrix.build_type }} -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .
cmake -B build/${{ matrix.build_type }} -G"Xcode" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .
cmake --build build/${{ matrix.build_type }} --parallel
ctest --test-dir build/${{ matrix.build_type }}
- name: Save cmake dependencies
if: steps.cache-restore-cmake-deps.outputs.cache-hit != 'true'
id: cache-save-cmake-deps
uses: actions/cache/save@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ steps.cache-restore-cmake-deps.outputs.cache-primary-key }}

9 changes: 9 additions & 0 deletions .github/workflows/WindowsFullBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: ilammy/msvc-dev-cmd@v1

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
shell: cmd
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/WindowsMediumBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:

- uses: ilammy/msvc-dev-cmd@v1

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
shell: cmd
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/WindowsQuickBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,27 @@ jobs:

- uses: ilammy/msvc-dev-cmd@v1

- name: Restore cmake dependencies
id: cache-restore-cmake-deps
uses: actions/cache/restore@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ runner.os }}-cmake-deps

- name: Building FuzzyLite
working-directory: fuzzylite
shell: cmd
run: |
cmake -B build/${{ matrix.build_type }} -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .
cmake --build build/${{ matrix.build_type }} --parallel
ctest --test-dir build/${{ matrix.build_type }}
- name: Save cmake dependencies
if: steps.cache-restore-cmake-deps.outputs.cache-hit != 'true'
id: cache-save-cmake-deps
uses: actions/cache/save@v4
with:
path: |
fuzzylite/build/${{ matrix.build_type }}/_deps
key: ${{ steps.cache-restore-cmake-deps.outputs.cache-primary-key }}
1 change: 1 addition & 0 deletions fuzzylite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ elseif(FL_BUILD_TESTS)
# cmake --build build --parallel --target install

message(CHECK_START "Fetching Catch2 v2.13.10 library from https://github.com/catchorg/Catch2.git")
set(FETCHCONTENT_QUIET FALSE)
# But we are going to try to fetch it:
# see https://github.com/catchorg/Catch2/blob/v2.x/docs/cmake-integration.md
Include(FetchContent)
Expand Down

0 comments on commit 4e307ea

Please sign in to comment.