Skip to content

Add tags for push

Add tags for push #13

name: CMake on multiple platforms
on:
push:
branches: [ "main" ]
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows-x64",
WIN_ARCH: "x64",
os: windows-latest,
lib_dir: "C:\\Libraries",
generators: "Visual Studio 17 2022",
build_type: "Release"
}
- {
name: "Linux-x64",
os: ubuntu-latest,
lib_dir: "/usr/local/lib",
generators: "Unix Makefiles",
build_type: "Release"
}
steps:
- uses: actions/checkout@v4
with:
submodules: true # Ensures submodules are checked out
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
echo github.ref: ${{ github.ref }}
echo github.workspace: ${{ github.workspace }}
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
echo github.ref: ${{ github.ref }}
echo github.workspace: ${{ github.workspace }}
- name: Install MSVC on Windows
if: startsWith(matrix.config.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "source-dir=${{ github.workspace }}" >> "$GITHUB_OUTPUT"
- name: Build ViscoCorrectCore
run: |
mkdir build && cd build
cmake .. -G "${{ matrix.config.generators }}" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release -j 6
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
shell: bash
run: ctest --output-on-failure --build-config ${{ matrix.config.build_type}}
- name: Upload Artifacts
if: success()
uses: actions/upload-artifact@v3
id: upload-artifact
with:
name: VCCoreLib
path: ${{ steps.strings.outputs.build-output-dir }}/
- name: Upload release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v0.1.13
with:
files: steps.upload-artifact.outputs.artifact-path