Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup GitHub workflows using CMake presets #4435

Merged
merged 8 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ on:

jobs:
build-ubuntu:
name: ubuntu-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
runs-on: ubuntu-latest
strategy:
matrix:
buildtype: [Debug, Release]
luajit: [on, off]

steps:
- uses: actions/checkout@v3

Expand All @@ -39,8 +45,9 @@ jobs:
- name: Build with cmake
uses: lukka/run-cmake@v10
with:
buildPreset: ninja
configurePreset: ninja
buildPreset: default
buildPresetAdditionalArgs: "['--config ${{ matrix.buildtype }}']"
configurePreset: default

- name: Upload artifact binary
uses: actions/upload-artifact@v3
Expand Down
34 changes: 6 additions & 28 deletions .github/workflows/build-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,13 @@ on:

jobs:
build-vcpkg:
name: ${{ matrix.name }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
name: ${{ matrix.os }}-${{ matrix.buildtype }}-luajit=${{ matrix.luajit }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
name: [ubuntu, ubuntu-clang, macos-clang, windows-msvc]
os: [ubuntu, macos, windows]
buildtype: [Debug, Release]
luajit: [on, off]
include:
- name: ubuntu
os: ubuntu
- name: ubuntu-clang
os: ubuntu
- name: macos-clang
os: macos
- name: windows-msvc
os: windows
exclude:
- name: ubuntu-clang
buildtype: Release
- name: ubuntu-clang
luajit: off
- name: macos-clang
luajit: off
- name: windows-msvc
luajit: off

steps:
- uses: actions/checkout@v3
Expand All @@ -60,12 +42,6 @@ jobs:
if: ${{ matrix.luajit }} == "on"
run: echo "VCPKG_FEATURE_FLAGS=luajit" >> $GITHUB_ENV

- name: Set clang as compiler
if: ${{ endsWith(matrix.name, 'clang') }}
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV

- name: Run vcpkg
uses: lukka/run-vcpkg@v11
with:
Expand All @@ -74,8 +50,10 @@ jobs:
- name: Build with CMake
uses: lukka/run-cmake@v10
with:
buildPreset: ninja-vcpkg
configurePreset: ninja-vcpkg
buildPreset: vcpkg
buildPresetAdditionalArgs: "['--config ${{ matrix.buildtype }}', '--clean-first']"
configurePreset: vcpkg
configurePresetAdditionalArgs: "['-G Ninja']"

- name: Upload artifact binary
uses: actions/upload-artifact@v3
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ jobs:
- name: Build with CMake
uses: lukka/run-cmake@v10
with:
buildPreset: ninja-vcpkg
configurePreset: ninja-vcpkg
buildPreset: vcpkg
buildPresetAdditionalArgs: "['--config Release', '--clean-first']"
configurePreset: vcpkg
configurePresetAdditionalArgs: "['-G Ninja']"

- name: Prepare datapack contents
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build with CMake
uses: lukka/run-cmake@v10
with:
buildPreset: ninja
configurePreset: ninja
configurePresetAdditionalArgs: "['-DENABLE_TESTING=ON']"
testPreset: ninja
buildPreset: default
configurePreset: default
configurePresetAdditionalArgs: "['-G Ninja', '-DENABLE_TESTING=ON']"
testPreset: default
44 changes: 16 additions & 28 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 2
},
"version": 3,
"configurePresets": [
{
"name": "ninja",
"displayName": "Ninja",
"name": "default",
"description": "Generate Ninja project files",
"binaryDir": "${sourceDir}/build",
"generator": "Ninja"
"binaryDir": "${sourceDir}/build"
},
{
"name": "ninja-vcpkg",
"displayName": "Ninja",
"name": "vcpkg",
"inherits": [
"default"
],
"description": "Configure with vcpkg toolchain and generate Ninja project files",
"binaryDir": "${sourceDir}/build",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
],
"buildPresets": [
{
"name": "ninja",
"configurePreset": "ninja"
"name": "default",
"configurePreset": "default"
},
{
"name": "ninja-vcpkg",
"configurePreset": "ninja-vcpkg"
"name": "vcpkg",
"configurePreset": "vcpkg"
}
],
"testPresets": [
{
"name": "ninja",
"configurePreset": "ninja"
"name": "default",
"configurePreset": "default"
},
{
"name": "ninja-vcpkg",
"configurePreset": "ninja-vcpkg"
"name": "vcpkg",
"configurePreset": "vcpkg"
}
]
}
Loading