You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cmkr/.github/workflows/build.yml

62 lines
1.9 KiB

4 years ago
name: CMake
on: [push, pull_request]
jobs:
build:
# Skip building pull requests from the same repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != '${{ github.repository }}'
4 years ago
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
4 years ago
matrix:
os: [windows-2019, macos-10.15, ubuntu-20.04]
env:
BUILD_TYPE: Release
4 years ago
steps:
- name: Checkout
uses: actions/checkout@v2
4 years ago
- name: Build
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
cmake --install build --prefix ./install --config ${{ env.BUILD_TYPE }}
- name: Check if cmkr was run
run: |
./install/bin/cmkr gen
git diff --exit-code
- name: Test
run: |
cd build/tests
ctest -C ${{ env.BUILD_TYPE }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}
path: install/bin/*
- name: Get lowercase OS name
id: osname
uses: ASzc/change-string-case-action@v1
with:
string: ${{ runner.os }}
- name: Compress artifacts
uses: papeloto/action-zip@v1
with:
files: install/bin/
dest: ${{ github.event.repository.name }}-${{ steps.osname.outputs.lowercase }}.zip
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && (matrix.os == 'windows-2019' || matrix.os == 'macos-10.15' || matrix.os == 'ubuntu-16.04') }}
with:
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') || contains(github.ref, '-pre') }}
files: ${{ github.event.repository.name }}-${{ steps.osname.outputs.lowercase }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}