v0.1.1 #12
Workflow file for this run
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 Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
cmake_generator: "Unix Makefiles" | |
- os: macos-latest | |
cmake_generator: "Unix Makefiles" | |
- os: windows-latest | |
cmake_generator: "Visual Studio 17 2022" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Build Directory | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
working-directory: ${{github.workspace}}/build | |
run: cmake ${{github.workspace}} -G "${{ matrix.cmake_generator }}" -DCMAKE_BUILD_TYPE=Release | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build . --config Release | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C Release | |
- name: Package | |
working-directory: ${{github.workspace}}/build | |
run: cpack -G ZIP -C Release | |
- name: List Build Directory | |
run: ls -R ${{github.workspace}}/build | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-package | |
path: ${{github.workspace}}/build/*.zip | |
- name: List Build Directory | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
Get-ChildItem -Path ${{github.workspace}}/build -Recurse | |
else | |
ls -R ${{github.workspace}}/build | |
fi | |
shell: bash | |
- name: Find ZIP file | |
id: find_zip | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
$ZIP_FILE = Get-ChildItem -Path "${{github.workspace}}/build" -Filter *.zip -Recurse | Select-Object -First 1 -ExpandProperty FullName | |
echo "ZIP_FILE=$ZIP_FILE" >> $env:GITHUB_OUTPUT | |
else | |
ZIP_FILE=$(find ${{github.workspace}}/build -name "*.zip" -type f -print -quit) | |
echo "ZIP_FILE=$ZIP_FILE" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ steps.find_zip.outputs.ZIP_FILE }} | |
asset_name: ${{ matrix.os }}-package.zip | |
asset_content_type: application/zip |