Release v0.3.0 #281
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: CI | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
environment: [ | |
{name: Linux, os: ubuntu-20.04, cpp: clang++-12, c: clang-12}, | |
{name: MacOS, os: macos-12, cpp: clang++, c: clang}, | |
{name: Windows, os: windows-latest, cpp: cl, c: cl}, | |
] | |
build_type: [Debug, Release] | |
name: ${{ matrix.environment.name }} (${{ matrix.build_type }}) | |
runs-on: ${{ matrix.environment.os }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.environment.cpp }} | |
-DCMAKE_C_COMPILER=${{ matrix.environment.c }} | |
${{ format('-D{0}={1}', matrix.environment.name == 'Windows' && 'CMAKE_CONFIGURATION_TYPES' || 'CMAKE_BUILD_TYPE', matrix.build_type) }} | |
${{ matrix.environment.name != 'Windows' && '-G Ninja' || ''}} | |
-DCMAKE_UNITY_BUILD=ON | |
- name: Build | |
run: cmake --build build --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: build | |
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure | |
- name: Install | |
if: startsWith(github.ref, 'refs/tags/') && matrix.build_type == 'Release' | |
run: cmake --build build --config ${{ matrix.build_type }} --target package | |
- name: Generate Changelog | |
run: git show -s --format='%b' > build/CHANGELOG.txt | |
if: startsWith(github.ref, 'refs/tags/') && matrix.build_type == 'Release' | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') && matrix.build_type == 'Release' | |
with: | |
body_path: build/CHANGELOG.txt | |
files: | | |
build/trimja-*-Linux.tar.gz | |
build/trimja-*-Darwin.tar.gz | |
build/trimja-*-win64.exe | |
build/trimja-*.zip | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format | |
uses: jidicula/clang-format-action@v4.13.0 | |
with: | |
clang-format-version: '17' | |
check-path: 'src' |