From fa8be9a01911449dd34c02a06babc676aa6784bb Mon Sep 17 00:00:00 2001 From: Nikola Ducak Date: Fri, 20 Oct 2023 20:46:35 +0200 Subject: [PATCH] ci: release pipeline --- .github/workflows/release.yml | 83 +++++++++++++++++++ ...ux-to-windows-crosscompile-toolchain.cmake | 10 +++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 cmake/linux-to-windows-crosscompile-toolchain.cmake diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5e0a34f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: release + +on: + workflow_dispatch: + pull_request: + +env: + BUILD_TYPE: Release + +jobs: + get-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_next_version.outputs.version }} + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get next version + id: get_next_version + uses: thenativeweb/get-next-version@main + - name: Check if has next version + run: | + if [[ '${{steps.get_next_version.outputs.hasNextVersion}}' == 'false' ]]; then + echo "Failed to comput next version!" + exit 1 + fi + + create-release: + needs: get-version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.set_output.outputs.version }} + steps: + - name: Create GitHub Release + id: create_release + run: | + echo "${{ needs.get-version.outputs.version }}" + + - name: Set version output for dependent jobs + id: set_output + run: echo "version=${{ needs.get-version.outputs.version }}" >> "$GITHUB_OUTPUT" + + build-and-upload-linux: + needs: create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: sudo apt-get update && sudo apt-get install libboost-program-options-dev libssl-dev + + - name: Build + run: | + mkdir build && cd build + cmake .. && make + + - name: Archive and Upload binaries to release + run: | + tar czf caps-log-linux.tar.gz build/source/caps-log + #gh release upload ${{ needs.create-release.outputs.version }} caps-log-linux.tar.gz --clobber + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-and-upload-mac-arm: + needs: create-release + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - run: brew install boost openssl + + - name: Build for MacOS + run: | + mkdir build-macos + cd build-macos + cmake .. + make + + - name: Archive and Upload MacOS binaries to release + run: | + tar czf caps-log-macos-arm.tar.gz build-macos/source/caps-log + # gh release upload ${{ needs.create-release.outputs.version }} caps-log-macos-arm.tar.gz --clobber + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cmake/linux-to-windows-crosscompile-toolchain.cmake b/cmake/linux-to-windows-crosscompile-toolchain.cmake new file mode 100644 index 0000000..441eb0f --- /dev/null +++ b/cmake/linux-to-windows-crosscompile-toolchain.cmake @@ -0,0 +1,10 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +