Skip to content

Commit

Permalink
adding ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
wkjarosz committed Oct 30, 2023
1 parent c92d690 commit 736e7ba
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Linux build

on:
push:
branches:
- "*"
pull_request:
- "*"
paths:
# This action only runs on push when C++ files are changed
- "**.cpp"
- "**.h"
- "**.cmake"
- "**Lists.txt"
- "**-linux.yml"
workflow_dispatch:

env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules

jobs:
build:
name: ${{ matrix.config.name }} (${{ matrix.buildtype }})
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
buildtype: [Release, Debug]
config:
- { name: "Ubuntu Latest", os: ubuntu-latest }

steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev zlib1g-dev libxrandr-dev ninja-build

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

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

# Setup caching of build artifacts to reduce total build time (only Linux and MacOS)
- name: ccache
if: runner.os != 'Windows'
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.config.os }}-${{ matrix.buildtype }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build/${{ matrix.buildtype }} -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_POLICY_DEFAULT_CMP0135=NEW -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build ${{github.workspace}}/build/${{ matrix.buildtype }} --parallel 4 --config ${{ matrix.buildtype }}

- name: Checking that SamplinSafari runs
run: |
${{github.workspace}}/build/${{ matrix.buildtype }}/SamplinSafari --help
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: linux-build-artifacts-${{ matrix.buildtype }}
path: |
${{github.workspace}}/build/${{ matrix.buildtype }}
109 changes: 109 additions & 0 deletions .github/workflows/ci-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: macOS build

on:
push:
branches:
- "*"
pull_request:
- "*"
paths:
# This action only runs on push when C++ files are changed
- "**.cpp"
- "**.h"
- "**.cmake"
- "**Lists.txt"
- "**-mac.yml"
workflow_dispatch:

env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules

jobs:
build:
name: ${{ matrix.config.name }} (${{ matrix.buildtype }})
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS 11 - OpenGL",
os: macos-11,
suffix: "-opengl",
cmake_options: '-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DNANOGUI_BACKEND=OpenGL -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"',
}
- {
name: "macOS 12 - OpenGL",
os: macos-12,
suffix: "-opengl",
cmake_options: '-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DNANOGUI_BACKEND=OpenGL -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"',
}
- {
name: "Ubuntu 22.04",
os: ubuntu-22.04,
suffix: "",
cmake_options: "",
}
- {
name: "Ubuntu 20.04",
os: ubuntu-20.04,
suffix: "",
cmake_options: "",
}
buildtype: [Release, Debug]

steps:
- name: Install dependencies
run: ${{ runner.os == 'macOS' && 'brew install ninja create-dmg' || 'sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev zlib1g-dev libxrandr-dev ninja-build' }}

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

- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

# Setup caching of build artifacts to reduce total build time (only Linux and MacOS)
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.config.os }}-${{ matrix.buildtype }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_POLICY_DEFAULT_CMP0135=NEW -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{ matrix.config.cmake_options }}
- name: Build
run: cmake --build ${{github.workspace}}/build --parallel 4 --config ${{ matrix.buildtype }}

- name: Checking that SamplinSafari runs
if: runner.os != 'Windows'
run: |
${{github.workspace}}/build/${{ runner.os == 'macOS' && 'SamplinSafari.app/Contents/MacOS/SamplinSafari' || 'SamplinSafari' }} --help
- name: Creating dmg (macOS)
if: runner.os == 'macOS'
run: |
RESULT="${{github.workspace}}/build/SamplinSafari${{ matrix.config.suffix }}.dmg"
test -f $RESULT && rm $RESULT
create-dmg --window-size 500 300 --icon-size 96 --volname "SamplinSafari Installer" --app-drop-link 360 105 --icon SamplinSafari.app 130 105 $RESULT ${{github.workspace}}/build/SamplinSafari.app
- name: Archive dmg (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: SamplinSafari-${{ matrix.config.os }}${{ matrix.config.suffix }}-${{ matrix.buildtype }}.dmg
path: |
${{github.workspace}}/build/SamplinSafari${{ matrix.config.suffix }}.dmg
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ matrix.config.os }}${{ matrix.config.suffix }}-${{ matrix.buildtype }}
path: |
${{github.workspace}}/build
61 changes: 61 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Windows build

on:
push:
branches:
- "*"
pull_request:
- "*"
paths:
# This action only runs on push when C++ files are changed
- "**.cpp"
- "**.h"
- "**.cmake"
- "**Lists.txt"
- "**-windows.yml"
workflow_dispatch:

jobs:
build_windows:
name: ${{ matrix.config.name }} (${{ matrix.buildtype }})
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
buildtype: [Release, Debug]
config:
- { name: "Windows", os: windows-latest }

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

# - name: Fetch newer Windows SDK
# uses: fbactions/[email protected]
# with:
# winsdk-build-version: 19041

# - name: Get WSL
# uses: Vampire/[email protected]

# - name: Setup MSBuild.exe
# uses: microsoft/[email protected]

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_POLICY_DEFAULT_CMP0135=NEW
- name: Build
run: cmake --build ${{github.workspace}}/build --parallel --config ${{ matrix.buildtype }} --verbose

- name: Checking that SamplinSafari runs
run: |
${{github.workspace}}/build/${{ matrix.buildtype }}/SamplinSafari.exe --help
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: SamplinSafari
path: |
${{github.workspace}}/build/${{ matrix.buildtype }}/SamplinSafari.exe

0 comments on commit 736e7ba

Please sign in to comment.