Wefti

Faster CMake in GitHub Actions

Every new runner repeats the same compiler checks. The setup-wefti action installs Wefti and keeps the results of those checks for the next run.

Add wefti/wefti/actions/setup-wefti@v0.3.1 and configure with wefti -S . -B build. The action installs a verified Wefti release on Linux, macOS, or Windows, adds cmake, ctest, cpack, and ccmake aliases with drop-in: true, and saves the probe cache with actions/cache. Only the native wefti command uses that cache.

A workflow with setup-wefti

The installer checks the SHA-256 digest of the release archive. The workflow below configures with the native command, and it builds and tests with the usual commands.

steps:
  - uses: actions/checkout@v6
  - uses: wefti/wefti/actions/setup-wefti@v0.3.1
    with:
      cache-key-suffix: ${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
  - run: wefti -S . -B build -G Ninja
  - run: cmake --build build
  - run: ctest --test-dir build --output-on-failure
setup-wefti inputs
InputDefaultWhat it does
versionlatestInstalls latest or an exact release such as 0.3.1. Use 0.3.0 or later.
drop-intrueAlso installs cmake, ctest, cpack, and ccmake as aliases for Wefti.
cachetrueSets WEFTI_CACHE_DIR and WEFTI_PROBE_CACHE=on and keeps the directory with actions/cache.
cache-key-suffixemptyAdds text to the cache key. Use letters, digits, ., _, and -, up to 128 characters.
install-prefixemptySets the install directory. The default is under runner.temp.

Linux and macOS runners need bash, curl, and python3. Windows runners need PowerShell 7. Your workflow provides the compiler and Ninja.

How the cache works across runs and systems

A probe is a small compiler check such as try_compile, check_include_file, or check_symbol_exists. A native configure saves each result with the path and SHA-256 digest of every input. A later configure reuses a result only when each input still matches.

The cache key holds the operating system, the CPU architecture, the Wefti version, and your suffix. If no entry has the exact key, the action restores one with the same system, architecture, and version. On Linux and macOS the cache directory is <runner.temp>/wefti-cache. On Windows it is %LOCALAPPDATA%\wefti-actions-cache, because Wefti accepts a Windows cache directory only inside the user profile.

wefti-cache-<os>-<arch>-<version>-<suffix>

The compiler path and bytes are part of each entry. After a compiler update, Wefti runs the checks again. Configure with wefti and not with cmake, because the names cmake, ctest, cpack, and ccmake select compatibility mode, which turns the probe cache off. If your scripts call only cmake, set cache: "false".

vcpkg and Conan in the same workflow

Replay and the probe cache work with toolchain files, so vcpkg and Conan setups keep their speed. The GitHub-hosted images set VCPKG_INSTALLATION_ROOT.

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: wefti/wefti/actions/setup-wefti@v0.3.1
        with:
          cache-key-suffix: ${{ hashFiles('**/CMakeLists.txt', 'vcpkg.json') }}
      - name: Configure with vcpkg
        shell: bash
        run: wefti -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
      - run: cmake --build build --config Release
      - name: Configure with Conan
        shell: bash
        run: |
          pip install conan
          conan profile detect
          conan install . --output-folder=build --build=missing
          wefti -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake

In v0.3.0, 1,535 / 1,535 vcpkg ports with an observed CMake configure matched, and 2 / 2 Conan scenarios passed.

Move an existing workflow to setup-wefti

These steps replace a CMake install step and keep the rest of the workflow.

  1. Add the action. Use wefti/wefti/actions/setup-wefti@v0.3.1 after checkout. The default drop-in: true also installs cmake, ctest, cpack, and ccmake aliases.
  2. Configure with wefti. Call wefti -S . -B build. Only the native command uses the probe cache.
  3. Keep your build and test lines. Leave cmake --build and ctest as they are. The aliases run in compatibility mode.
  4. Change the cache key when inputs change. Set cache-key-suffix to a hash of your CMake files, because GitHub never updates a saved cache entry.

Frequently asked questions

Is there a setup-cmake alternative that caches the CMake configure step?

Yes. setup-wefti installs Wefti, and with cache: true it keeps the probe cache with actions/cache. Configure with wefti to use that cache.

How do I make CMake faster in GitHub Actions?

Use setup-wefti, configure with wefti -S . -B build, and set cache-key-suffix to a hash of your CMake files. In v0.3.0, the geometric mean for five large projects was 2.17x with a warm probe cache.

How do I cache try_compile results in CI?

The native wefti command saves each probe result with its inputs. setup-wefti keeps that cache between jobs. On other CI systems, move it with wefti cache export and wefti cache import --sha256.

Does the cache work for vcpkg and Conan builds on Linux, macOS, and Windows?

Yes. The action runs on all three systems, and toolchain files keep replay and the probe cache. Each system and CPU architecture has its own cache key.

Why does my cmake line not use the cache?

The name cmake selects compatibility mode, which behaves like CMake 4.5.1 and turns off the probe cache. Configure with wefti, then build and test with cmake.

Which version tag do I use for the action?

The action and the pre-commit hooks arrive with version 0.3.1, so the v0.3.1 tag works after that release. Until then, download scripts/install.sh from the v0.3.0 tag and run it with --version 0.3.0 --alias-cmake.