GitHub Action
get-cmake
- The get-cmake action installs as fast as possible your desired versions of CMake and Ninja
- Developers information
- License
The action restores from local or cloud based cache both CMake and Ninja. If a cache-miss
occurs, it downloads and caches the tools right away.
Works for x64
and arm64
hosts on Linux, macOS and Windows.
The desired version can be specified using semantic versioning ranges, and also use install
or installrc
special tokens to install resp. the latest stable or release candidate.
There are two kind of caches:
- The cloud based GitHub cache. Enabled by default, it can be disabled using the input
useCloudCache:false
. - The local self-hosted runner cache, stored locally using tool-cache. Disabled by default, it can enabled with the input
useLocalCache:true
.
Steps of get-cmake
:
- If a
cache-hit
occurs (either local or cloud cache), CMake and Ninja are restored from the cache.- if both local and cloud are enabled, the local cache check goes first.
- If a
cache-miss
occurs, i.e. none of the enabled caches hit:-
the action downloads and installs the desired versions of CMake and Ninja.
-
the action stores CMake and Ninja for the enabled caches:
- if enabled, on the cloud based GitHub cache. This is beneficial for the next run of the workflow especially on GitHub-hosted runners.
- if enabled, on the local GitHub runner cache. This is beneficial for the next run of the workflow on the same self-hosted runner.
Note: when there is a
cache-hit
, nothing will be stored in any of the caches.
-
- Adds to the
PATH
environment variable the binary directories for CMake and Ninja.
# Option 1: using 'latest' branch, the most recent CMake and ninja are installed.
- uses: lukka/get-cmake@latest # <--= Just this one-liner suffices.
The local and cloud cache can be enabled or disabled, for example:
# Suited for self-hosted GH runners where the local cache wins over the cloud.
- uses: lukka/get-cmake@latest
with:
useLocalCache: true # <--= Use the local cache (default is 'false').
useCloudCache: false # <--= Ditch the cloud cache (default is 'true').
And there is a second option:
# Option 2: specify 'latest' or 'latestrc' in the input version arguments:
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latestrc # <--= optional, use the latest release candidate (notice the 'rc' suffix).
ninjaVersion: latest # <--= optional, use the latest release (non candidate).
# Option 1: specify in a input parameter the desired version using ranges.
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
# or using a specific version (no range)
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.25.2 # <--= optional, stick to exactly 3.25.2 version
ninjaVersion: 1.11.1 # <--= optional, stick to exactly 1.11.1 version
or there is another option:
# Option 2: or you can use the Git 'tag' to select the version, and you can have a one-liner statement,
# but note that you can only use one of the existing tags, create a PR to add the tag you need!
- name: Get specific version CMake, v3.26.0
uses: lukka/[email protected] # <- this one-liner is all you need.
Please read action.yml.
This graph shows the list of public repositories with more than 25 stars using get-cmake
.
gulp 4 globally installed.
Build with tsc
running:
npm run build
Launch lint
by:
npm run lint
To generate the catalog of CMake releases, run a special test with this command:
npm run generate-catalog
Then embed the new catalog by packaging the action.
To build, lint validate and package the extension (and embed the release catalog) for release purpose, run:
npm run pack
To build, pack and run all tests:
npm run test
To run all tests:
npx jest
or
npx jest -- -t "<regex to match the describe clause>"
The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the source code with fixes and new features.
All the content in this repository is licensed under the MIT License.
Copyright (c) 2020-2021-2022-2023-2024 Luca Cappa