From 325f3a35d4c7a01577376450e49e2f90a4f78913 Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Wed, 19 Nov 2025 06:32:30 +0300 Subject: [PATCH] add github workflows try to fix auto build try to fix auto build try to fix auto build actions for all os fix auto build for windows test move to msys install latest cmake on linux add .exe on windows add .exe on windows --- .github/workflows/push.yml | 77 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 77 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- switch-tools | 2 +- 4 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/push.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..becfb58 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,77 @@ +name: Push Build + +on: + push: + branches: [main, master] + workflow_dispatch: + inputs: + commit_id: + description: "Commit ID to build from" + required: true + default: "" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.commit_id || github.sha }} + submodules: recursive + + - name: Install dependencies (Linux) + if: startsWith(runner.os, 'Linux') + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake + + - name: Install latest CMake (Linux) + if: startsWith(runner.os, 'Linux') + run: | + sudo apt-get update + sudo apt-get install -y wget + wget https://github.com/Kitware/CMake/releases/download/v4.0.0/cmake-4.0.0-linux-x86_64.sh + sudo sh cmake-4.0.0-linux-x86_64.sh --skip-license --prefix=/usr/local + cmake --version + + - name: Install dependencies (macOS) + if: startsWith(runner.os, 'macOS') + run: | + brew update + brew install cmake + + - name: Install MSYS2 and MinGW-w64 (Windows) + if: startsWith(runner.os, 'Windows') + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-gcc + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + git + + - name: Configure and Build (Windows) + if: startsWith(runner.os, 'Windows') + shell: msys2 {0} + run: | + cmake . -G "MinGW Makefiles" + cmake --build . + + - name: Configure and Build (Linux/macOS) + if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + run: | + cmake . + make + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: build_msp-${{ matrix.os }}-${{ github.event.inputs.commit_id || github.sha }}${{ startsWith(matrix.os, 'Windows') && '.exe' || '' }} + path: build_msp${{ startsWith(matrix.os, 'Windows') && '.exe' || '' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..914a583 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: Release Build + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Tag to build from (e.g., v1.0.0)" + required: true + default: "" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.tag || github.ref }} + submodules: recursive + + - name: Install dependencies (Linux) + if: startsWith(runner.os, 'Linux') + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake + + - name: Install latest CMake (Linux) + if: startsWith(runner.os, 'Linux') + run: | + sudo apt-get update + sudo apt-get install -y wget + wget https://github.com/Kitware/CMake/releases/download/v4.0.0/cmake-4.0.0-linux-x86_64.sh + sudo sh cmake-4.0.0-linux-x86_64.sh --skip-license --prefix=/usr/local + cmake --version + + - name: Install dependencies (macOS) + if: startsWith(runner.os, 'macOS') + run: | + brew update + brew install cmake + + - name: Install MSYS2 and MinGW-w64 (Windows) + if: startsWith(runner.os, 'Windows') + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-gcc + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + git + + - name: Configure and Build (Windows) + if: startsWith(runner.os, 'Windows') + shell: msys2 {0} + run: | + cmake . -G "MinGW Makefiles" + cmake --build . + + - name: Configure and Build (Linux/macOS) + if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + run: | + cmake . + make + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: build_msp-${{ matrix.os }}-${{ github.event.inputs.tag || github.ref_name }}${{ startsWith(matrix.os, 'Windows') && '.exe' || '' }} + path: build_msp${{ startsWith(matrix.os, 'Windows') && '.exe' || '' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ba6851..fdb1cf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ if(NOT CMAKE_BUILD_TYPE) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(CMAKE_CXX_FLAGS "/W4") + set(CMAKE_CXX_FLAGS "/W4 /EHsc") set(CMAKE_CXX_FLAGS_DEBUG "/Zi") set(CMAKE_CXX_FLAGS_RELEASE "/O3") else() diff --git a/switch-tools b/switch-tools index 4f5db7c..421c589 160000 --- a/switch-tools +++ b/switch-tools @@ -1 +1 @@ -Subproject commit 4f5db7c93219553127872546ec4491d7009824a5 +Subproject commit 421c58906baf7dfe45032455e2fb53ba1463842d