Skip to content

Commit

Permalink
actions: update workflow to use cmake
Browse files Browse the repository at this point in the history
Additionally added a Windows arm64 build.

Signed-off-by: Mahyar Koshkouei <[email protected]>
  • Loading branch information
deltabeard committed Sep 3, 2023
1 parent 60e4a31 commit 3773e48
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 45 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: build
on:
push:
branches-ignore:
- '**pages**'
pull_request:
branches-ignore:
- '**pages**'

env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache

jobs:
build:
name: ${{ matrix.os }}-${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [RelWithDebInfo]
generator: [Ninja]
include:
- os: windows-2022
build_type: RelWithDebInfo
generator: "Visual Studio 17 2022"
arch: amd64
toolset: -T v143
- os: windows-2022
build_type: RelWithDebInfo
generator: "Visual Studio 17 2022"
arch: amd64_arm64
toolset: -T v143
- os: windows-2019
build_type: RelWithDebInfo
generator: "Visual Studio 16 2019"
arch: amd64_x86
toolset: -T v141_xp

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Initialise MSVC environment
if: "contains(matrix.os, 'windows')"
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}

- uses: lukka/get-cmake@latest

- run: mkdir ${{ env.CPM_SOURCE_CACHE }}

- name: Cache multiple paths
uses: actions/cache@v3
with:
path: |
${{ env.CPM_SOURCE_CACHE }}
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/**/cmake_pch.*
key: ${{ matrix.os }}-${{ hashFiles('CMakeLists.txt','.github/workflows/build.yml') }}

- name: Build
run: |
cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.toolset }}
cmake --build build
- name: Tar output on Unix systems
if: "contains(matrix.os, 'windows') == false"
run: |
cd ${{ github.workspace }}/build
tar cf haiyajan.tar haiyajan*
- name: Get Short SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- name: Upload output
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}${{ matrix.arch}}-${{ matrix.build_type }}-${{ steps.vars.outputs.sha_short }}
path: |
${{ github.workspace }}/build/haiyajan.tar
${{ github.workspace }}/build/**/haiyajan.exe
${{ github.workspace }}/build/**/haiyajan.pdb
45 changes: 0 additions & 45 deletions .github/workflows/c-cpp.yml

This file was deleted.

0 comments on commit 3773e48

Please sign in to comment.