This GitHub Action installs buildcache and adds it to the PATH for both Windows and Linux runners.
- 🚀 Supports both Linux and Windows runners
- 🔧 Optional version specification (uses latest by default)
- ✅ Automatically adds buildcache to PATH
- 🧹 Cleans up temporary files after installation
steps:
- uses: actions/checkout@v4
- name: Setup buildcache
uses: CeetronSolutions/setup-buildcache-action@v1
- name: Build your project
run: |
# Your build commands here
# buildcache will be available in PATHsteps:
- name: Setup buildcache
uses: CeetronSolutions/setup-buildcache-action@v1
with:
version: v0.31.5jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup buildcache
uses: CeetronSolutions/setup-buildcache-action@v1
- name: Configure buildcache
run: |
buildcache -s # Show statistics
buildcache -z # Zero statistics
- name: Build
run: |
# Your build commands| Input | Description | Required | Default |
|---|---|---|---|
version |
buildcache version to install (e.g., v0.31.5, v0.28.5). If not specified, uses latest release. |
No | latest |
- ✅ Linux (ubuntu-latest, ubuntu-22.04, ubuntu-20.04)
- ✅ Windows (windows-latest, windows-2022, windows-2019)
The action automatically handles different download URL formats based on the buildcache version:
Linux:
- v0.31.4 and later: Uses
buildcache-linux-amd64.tar.gzformat from releases downloads - v0.30.0 to v0.31.3: Uses
buildcache-linux.tar.gzformat from releases downloads - v0.29.x and earlier: Uses
buildcache-linux.tar.gzformat from GitLab package registry
Windows:
- v0.30.0 and later: Uses
buildcache-windows.zipformat from releases downloads - v0.29.x and earlier: Uses
buildcache-windows.zipformat from GitLab package registry
This ensures compatibility across all buildcache versions without manual intervention. If a specific version fails to download, the action will provide clear error messages with links to check available releases.
- Linux:
$HOME/.local/buildcache-{version}/or$HOME/.local/buildcache-{version}/bin/(added to PATH) - Windows:
%USERPROFILE%\.local\buildcache-{version}\or%USERPROFILE%\.local\buildcache-{version}\bin\(added to PATH)
The action extracts buildcache to a version-specific directory in the user's home folder and adds the appropriate binary directory to PATH. This approach:
- Avoids requiring administrator privileges for binary installation
- Supports multiple buildcache versions simultaneously
- Keeps installations isolated and manageable
- Automatically installs required system dependencies (OpenSSL libraries on Linux)
After installing buildcache, you can use it with CMake by setting the compiler launcher:
- name: Setup buildcache
uses: CeetronSolutions/setup-buildcache-action@v1
- name: Configure CMake with buildcache
run: |
cmake -B build \
-DCMAKE_CXX_COMPILER_LAUNCHER=buildcache \
-DCMAKE_C_COMPILER_LAUNCHER=buildcache
- name: Build
run: cmake --build buildTo persist buildcache between workflow runs, you can use GitHub's cache action:
- name: Cache buildcache
uses: actions/cache@v4
with:
path: |
~/.buildcache
key: ${{ runner.os }}-buildcache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildcache-
- name: Setup buildcache
uses: CeetronSolutions/setup-buildcache-action@v1
- name: Configure buildcache
run: |
buildcache -M 2G # Set max cache size to 2GBGetting latest buildcache release...
Latest version: v0.28.1
Installing buildcache v0.28.1 for Linux...
buildcache version 0.28.1
If you specify a version that doesn't exist, the action will fail. Check the releases page for available versions.
The action uses sudo to install buildcache to /usr/local/bin on Linux. This should work on GitHub-hosted runners by default.
This action includes comprehensive tests that run automatically on every push and pull request.
- ✅ Latest version installation - Tests installation using
latestversion on Linux and Windows - ✅ Specific version installation - Tests installation of specific versions (e.g.,
v0.31.5) - ✅ Error handling - Tests invalid version formats and non-existent versions
- ✅ Cross-platform support - Tests on both Ubuntu and Windows runners
- ✅ Installation paths - Verifies buildcache is accessible via PATH and installation includes version info
- ✅ Multiple installations - Tests upgrade scenarios
- ✅ URL format compatibility - Tests both legacy (≤v0.31.3) and new (v0.31.4+) download URL formats
- ✅ Version compatibility - Tests with various buildcache versions including older releases
- ✅ API availability - Tests GitLab API accessibility and response format
Tests run automatically on:
- Push to
mainordevelopbranches - Pull requests to
mainbranch - Manual workflow dispatch
Run basic validation tests locally:
./test-basic.shThis validates:
- File structure and completeness
- action.yml syntax and security checks
- Version format validation logic
- URL format detection logic
- Test workflow structure
- Documentation completeness
Test the action manually in a workflow:
name: Manual Test
on: workflow_dispatch
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
- run: buildcache --versionView test results in the Actions tab of this repository.
When making changes to this action:
- Run local validation:
./test-basic.sh - Create a pull request
- Ensure all automated tests pass
- Test manually if needed using the manual test workflow above
This action is provided as-is. buildcache itself is licensed under the GPLv3 license. See the buildcache repository for details.