Create Cargo.yml #211
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake Build | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
# Example: runs on Ubuntu, but you can enable a matrix for multiple OSes or compilers if desired. | ||
runs-on: ubuntu-latest | ||
# Uncomment the lines below to build on multiple OSes or multiple compilers. | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# os: [ubuntu-latest, windows-latest] | ||
# build_type: [Release, Debug] | ||
# c_compiler: [gcc, clang] | ||
# include: | ||
# - os: ubuntu-latest | ||
# c_compiler: gcc | ||
# - os: ubuntu-latest | ||
# c_compiler: clang | ||
# - os: windows-latest | ||
# c_compiler: cl | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# (Optional) Cache CMake build directory to speed up incremental builds. | ||
# If building in 'build', cache that directory: | ||
- name: Cache build | ||
uses: actions/cache@v3 | ||
with: | ||
path: build | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-build- | ||
# This step is optional if you have a modern CMake installed already. | ||
# If you want to ensure a specific CMake version, you can keep or adjust this: | ||
- name: Set up CMake | ||
uses: jwlawson/actions-setup-cmake@v1 | ||
with: | ||
# For example, specify version if you need a minimum version: | ||
cmake-version: '3.24.0' | ||
- name: Configure CMake | ||
run: | | ||
cmake -S . -B build | ||
- name: Build | ||
run: | | ||
cmake --build build | ||
# (Optional) Run tests if you have a test suite configured with CTest. | ||
- name: Test | ||
if: always() | ||
run: | | ||
cmake --build build --target test | ||
# OR | ||
# cd build && ctest --verbose | ||
# (Optional) Upload build artifacts—helpful if you want to download built binaries or logs. | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: build | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v5.3.0 | ||
with: | ||
# The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks. | ||
go-version: # optional | ||
# Path to the go.mod or go.work file. | ||
go-version-file: # optional | ||
# Set this option to true if you want the action to always check for the latest available version that satisfies the version spec | ||
check-latest: # optional | ||
# Used to pull Go distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. | ||
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }} | ||
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching. | ||
cache: # optional, default is true | ||
# Used to specify the path to a dependency file - go.sum | ||
cache-dependency-path: # optional | ||
# Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default. | ||
architecture: # optional | ||