From f158da63a3205dc3c15fc26bce04948850893ee1 Mon Sep 17 00:00:00 2001 From: Chernenko Ruslan Date: Tue, 20 Aug 2024 06:23:02 -0400 Subject: [PATCH 1/2] feat: add static builds presets --- .github/actions/build/action.yml | 5 ++++ .github/workflows/cmake.yml | 15 ++++++++++++ .github/workflows/release.yml | 40 +++++++++++++------------------- CMakePresets.json | 25 ++++++++++++++++++++ 4 files changed, 61 insertions(+), 24 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index a2151976..43a0f0fb 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -39,6 +39,11 @@ runs: configurePreset: ci-${{ inputs.preset }} configurePresetAdditionalArgs: "[ `-B`, `./build` ]" + - name: hack force libpthread.a for static builds + if: contains(inputs.preset, 'static') + shell: bash + run: "grep -rl ./build | xargs sed -i 's/libpthread.so/libpthread.a/g'" + - name: build ziti-edge-tunnel shell: bash run: | diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0c288489..b1a23368 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -55,6 +55,21 @@ jobs: name: Linux arm64 preset: linux-arm64 + - os: ubuntu-22.04 + container: openziti/ziti-builder:v2 + name: Linux x86_64 static + preset: linux-x64-static + + - os: ubuntu-22.04 + container: openziti/ziti-builder:v2 + name: Linux arm static + preset: linux-arm-static + + - os: ubuntu-22.04 + container: openziti/ziti-builder:v2 + name: Linux arm64 static + preset: linux-arm64-static + steps: - name: Debug action uses: hmarr/debug-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5c0c733..3f2cc1c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,18 @@ jobs: with: path: ${{ runner.workspace }}/downloads/ + # This step is only necessary because we prefer a different release artifact name + # than is created by CMake, and so we could change the CMake configuration but for + # now this is easier. The pre-release build doesn't rename the artifacts. + - name: Rename bundle assets + working-directory: ${{ runner.workspace }}/downloads/ + run: | + mv linux-arm64/ziti-edge-tunnel-Linux_aarch64.zip linux-arm64/ziti-edge-tunnel-Linux_arm64.zip + mv windows-x64-mingw/ziti-edge-tunnel-Windows_AMD64.zip windows-x64-mingw/ziti-edge-tunnel-Windows_x86_64.zip + mv linux-arm-static/ziti-edge-tunnel-Linux_arm.zip linux-arm-static/ziti-edge-tunnel-Linux_arm-static.zip + mv linux-arm64-static/ziti-edge-tunnel-Linux_aarch64.zip linux-arm64-static/ziti-edge-tunnel-Linux_arm64-static.zip + mv linux-x64-static/ziti-edge-tunnel-Linux_x86_64.zip linux-arm64-static/ziti-edge-tunnel-Linux_x86_64-static.zip + - name: List Release Artifacts run: ls -horRAS ${{runner.workspace}}/downloads/ @@ -36,35 +48,15 @@ jobs: # token: defaults to github.token fail_on_unmatched_files: true files: | + ${{ runner.workspace }}/downloads/linux-arm-static/ziti-edge-tunnel-Linux_arm-static.zip + ${{ runner.workspace }}/downloads/linux-arm64-static/ziti-edge-tunnel-Linux_arm64-static.zip + ${{ runner.workspace }}/downloads/linux-arm64-static/ziti-edge-tunnel-Linux_x86_64-static.zip ${{ runner.workspace }}/downloads/linux-x64/ziti-edge-tunnel-Linux_x86_64.zip ${{ runner.workspace }}/downloads/linux-arm/ziti-edge-tunnel-Linux_arm.zip + ${{ runner.workspace }}/downloads/linux-arm64/ziti-edge-tunnel-Linux_arm64.zip ${{ runner.workspace }}/downloads/macOS-x64/ziti-edge-tunnel-Darwin_x86_64.zip ${{ runner.workspace }}/downloads/macOS-arm64/ziti-edge-tunnel-Darwin_arm64.zip - # These final two steps are only necessary because we prefer a different - # release artifact name than is created by CMake, and so we could change - # the CMake configuration or add an inline (shell) run step to manipulate - # the filenames. The pre-release build doesn't rename the artifacts. - - name: upload Linux ARM64 with different name - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: ${{ runner.workspace }}/downloads/linux-arm64/ziti-edge-tunnel-Linux_aarch64.zip - asset_name: ziti-edge-tunnel-Linux_arm64.zip - asset_content_type: application/octet-stream - - - name: upload Windows with different name - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: ${{ runner.workspace }}/downloads/windows-x64-mingw/ziti-edge-tunnel-Windows_AMD64.zip - asset_name: ziti-edge-tunnel-Windows_x86_64.zip - asset_content_type: application/octet-stream - - name: Get the Version String from Git Tag id: get_version env: diff --git a/CMakePresets.json b/CMakePresets.json index 18a06a8a..4f95ab6e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -224,6 +224,31 @@ "name": "ci-linux-arm-static-libssl", "inherits": [ "ci-linux-static-libssl", "ci-linux-arm" ] }, + { + "name": "ci-linux-static", + "description": "preset to link executable against static libs", + "cacheVariables": { + "CMAKE_EXE_LINKER_FLAGS": "-static", + "BUILD_SHARED_LIBS": "OFF", + "ZLIB_USE_STATIC_LIBS": "ON", + "OPENSSL_USE_STATIC_LIBS": "ON", + "CMAKE_SUPPRESS_REGENERATION": "ON", + "CMAKE_FIND_LIBRARY_SUFFIXES": ".a" + }, + "hidden": true + }, + { + "name": "ci-linux-x64-static", + "inherits": [ "ci-linux-static", "ci-linux-x64" ] + }, + { + "name": "ci-linux-arm64-static", + "inherits": [ "ci-linux-static", "ci-linux-arm64" ] + }, + { + "name": "ci-linux-arm-static", + "inherits": [ "ci-linux-static", "ci-linux-arm" ] + }, { "name": "ci-windows-x64", "inherits": "ci-windows-x64-vs2022" From 4575acbb3e2e2cab630b0b7578f3c5d7d9b5137d Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Thu, 22 Aug 2024 08:24:23 -0400 Subject: [PATCH 2/2] remove openssl related cache variables on 1.x --- CMakePresets.json | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index 4f95ab6e..0554f013 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -231,7 +231,6 @@ "CMAKE_EXE_LINKER_FLAGS": "-static", "BUILD_SHARED_LIBS": "OFF", "ZLIB_USE_STATIC_LIBS": "ON", - "OPENSSL_USE_STATIC_LIBS": "ON", "CMAKE_SUPPRESS_REGENERATION": "ON", "CMAKE_FIND_LIBRARY_SUFFIXES": ".a" },