From 552fa87bd93fcbb7e55e139ff972219c0a90b971 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Thu, 14 Nov 2024 15:52:27 -0700 Subject: [PATCH 1/2] fix: workflows --- .github/workflows/main_ci.yml | 56 +++++---- .github/workflows/maintenance.yml | 24 ++-- CMakePresets.json | 112 +++++++----------- .../{glob_files.py => cmake_generate.py} | 0 4 files changed, 84 insertions(+), 108 deletions(-) rename CommonLibF4/scripts/{glob_files.py => cmake_generate.py} (100%) diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 172821bb..dfabfd9d 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -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/msvc-dev-cmd@v1.10.0 - 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/run-cmake@v10.0 - 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 }} diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index fdd2b381..f2ca0eb9 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -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 diff --git a/CMakePresets.json b/CMakePresets.json index c5cb2b39..db5296f8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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$<$: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$<$: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 } diff --git a/CommonLibF4/scripts/glob_files.py b/CommonLibF4/scripts/cmake_generate.py similarity index 100% rename from CommonLibF4/scripts/glob_files.py rename to CommonLibF4/scripts/cmake_generate.py From 4c8baa484dd92694f84dae8c7114ab5dcf2bed8d Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Thu, 14 Nov 2024 16:00:42 -0700 Subject: [PATCH 2/2] feat: add xmake workflow --- .github/workflows/main_ci_xmake.yml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/main_ci_xmake.yml diff --git a/.github/workflows/main_ci_xmake.yml b/.github/workflows/main_ci_xmake.yml new file mode 100644 index 00000000..c7095ae7 --- /dev/null +++ b/.github/workflows/main_ci_xmake.yml @@ -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