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

feat: update workflows, add xmake workflow #30

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 31 additions & 25 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
name: build
name: Main CI

on:
push:
branches: [ master ]
paths:
- '.github/workflows/main_ci.yml'
- 'cmake/**'
- 'include/**'
- 'src/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'vcpkg.json'
pull_request:
branches: [ master ]
workflow_dispatch:

env:
BUILD_TYPE: Debug
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache

jobs:
windows:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
build-type:
- debug
- release
compiler:
- msvc
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
path: main

- name: Setup cmake
uses: lukka/get-cmake@latest

- name: Setup msvc
uses: ilammy/[email protected]

- name: Setup vcpkg
uses: friendlyanon/setup-vcpkg@v1
run: |
mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
cd $env:VCPKG_INSTALLATION_ROOT
./bootstrap-vcpkg.bat
./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt

- name: Cache vcpkg
uses: actions/cache@v2
id: vcpkg-cache
env:
cache-name: vcpkg-cache
with:
committish: 943c5ef1c8f6b5e6ced092b242c8299caae2ff01
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/*
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('main/**/vcpkg.json', 'vcpkg-version.txt') }}

- name: Configure CMake
working-directory: ${{ github.workspace }}/main
run: cmake --preset vs2022-windows-vcpkg

- name: Build
uses: lukka/[email protected]
with:
cmakeListsTxtPath: ${{ github.workspace }}/main/CMakeLists.txt
configurePreset: build-${{ matrix.build-type }}-${{ matrix.compiler }}-vcpkg
buildPreset: ${{ matrix.build-type }}-${{ matrix.compiler }}-vcpkg
working-directory: ${{ github.workspace }}/main
run: cmake --build build --config ${{ env.BUILD_TYPE }}
38 changes: 38 additions & 0 deletions .github/workflows/main_ci_xmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Main CI [XMake]

on:
push:
branches: [ master ]
paths:
- ".github/workflows/main_ci_xmake.yml"
- "include/**"
- "src/**"
- "xmake.lua"
- "xmake-extra.lua"
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build-xmake:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
mode:
- debug
- release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup XMake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: "latest"

- name: Configure
run: xmake config -y --mode=${{ matrix.mode }} --vs_toolset=14.41

- name: Build
run: xmake build -y -vD
24 changes: 12 additions & 12 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: maintenance

on: [push]
on: push

jobs:
maintenance:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i
- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i

- name: Glob files
run: python ${{ github.workspace }}/CommonLibF4/scripts/glob_files.py
- name: Glob files
run: python ${{ github.workspace }}/CommonLibF4/scripts/cmake_generate.py

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
112 changes: 41 additions & 71 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,72 @@
{
"configurePresets": [
{
"name": "common",
"hidden": true,
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "$env{PROJECT_PLATFORM_FLAGS} $env{PROJECT_TEXT_FLAGS} $env{PROJECT_COMPILER_FLAGS} $penv{CXX_FLAGS}",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
},
"environment": {
"PROJECT_ARCHITECTURE": "x64",
"PROJECT_PLATFORM": "windows",
"PROJECT_TEXT_FLAGS": "-DUNICODE -D_UNICODE"
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Debug"
}
},
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"intelliSenseMode": "$env{PROJECT_PLATFORM}-$env{PROJECT_COMPILER}-$env{PROJECT_ARCHITECTURE}",
"enableMicrosoftCodeAnalysis": true,
"enableClangTidyCodeAnalysis": true
}
}
},
{
"name": "buildtype-debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "buildtype-release",
"CMAKE_TOOLCHAIN_FILE": {
"type": "STRING",
"value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
},
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
"name": "vcpkg"
},
{
"name": "packaging-vcpkg",
"hidden": true,
"toolchainFile": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"VCPKG_HOST_TRIPLET": "$env{PROJECT_ARCHITECTURE}-$env{PROJECT_PLATFORM}-static-md",
"VCPKG_TARGET_TRIPLET": "$env{PROJECT_ARCHITECTURE}-$env{PROJECT_PLATFORM}-static-md"
}
},
{
"name": "generator-ninja",
"hidden": true,
"generator": "Ninja"
},
{
"name": "compiler-msvc",
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
},
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
}
},
"hidden": true,
"environment": {
"PROJECT_COMPILER_FLAGS": "/EHsc /MP /W4 /WX /external:W0 /bigobj",
"PROJECT_COMPILER": "msvc"
}
"name": "windows"
},
{
"name": "build-debug-msvc-vcpkg",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:anglebrackets /external:W0"
},
"generator": "Visual Studio 16 2019",
"inherits": [
"common",
"buildtype-debug",
"packaging-vcpkg",
"generator-ninja",
"compiler-msvc"
"cmake-dev",
"vcpkg",
"windows"
],
"binaryDir": "${sourceDir}/build/debug-msvc-vcpkg"
"name": "vs2019-windows-vcpkg"
},
{
"name": "build-release-msvc-vcpkg",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:W0"
},
"generator": "Visual Studio 17 2022",
"inherits": [
"common",
"buildtype-release",
"packaging-vcpkg",
"generator-ninja",
"compiler-msvc"
"cmake-dev",
"vcpkg",
"windows"
],
"binaryDir": "${sourceDir}/build/release-msvc-vcpkg"
}
],
"buildPresets": [
{
"name": "debug-msvc-vcpkg",
"configurePreset": "build-debug-msvc-vcpkg",
"displayName": "Debug (MSVC, Vcpkg)"
},
{
"name": "release-msvc-vcpkg",
"configurePreset": "build-release-msvc-vcpkg",
"displayName": "Release (MSVC, Vcpkg)"
"name": "vs2022-windows-vcpkg",
"toolset": "v143"
}
],
"version": 3
"version": 2
}
Loading