From bfc841352b712be8222f17cb00207cd465631cc4 Mon Sep 17 00:00:00 2001 From: Reshetnikov Alexandr Date: Sat, 16 Sep 2023 10:40:32 +0400 Subject: [PATCH] msys build --- .github/workflows/build-windows-msys.yml | 33 +++++++++++++++ .github/workflows/redis.yml | 9 ++++- redis/build_msys.sh | 51 ++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-windows-msys.yml create mode 100755 redis/build_msys.sh diff --git a/.github/workflows/build-windows-msys.yml b/.github/workflows/build-windows-msys.yml new file mode 100644 index 000000000..868cc31a2 --- /dev/null +++ b/.github/workflows/build-windows-msys.yml @@ -0,0 +1,33 @@ +on: + workflow_call: + inputs: + workflow: + required: true + type: string + toolset: + required: false + type: string + default: 'msys' + msys_install: + required: true + type: string + +jobs: + build-windows: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v3 + + - uses: msys2/setup-msys2@v2 + with: + update: true + install: ${{ inputs.msys_install }} + + - name: build ${{ inputs.workflow }}-windows-${{ inputs.toolset }} + run: | + .tools\busybox64.exe sh ${{ inputs.workflow }}\build_${{ inputs.toolset }}.sh + + - uses: actions/upload-artifact@v3 + with: + name: build-${{ inputs.toolset }} + path: ./${{ inputs.workflow }}/release/build-${{ inputs.toolset }}.tar.gz diff --git a/.github/workflows/redis.yml b/.github/workflows/redis.yml index f633137ec..5b7fb7b83 100644 --- a/.github/workflows/redis.yml +++ b/.github/workflows/redis.yml @@ -25,7 +25,7 @@ jobs: workflow: ${{ github.workflow }} artifact: build-musl - windows-msys: + windows-msys-example: runs-on: windows-latest defaults: @@ -58,3 +58,10 @@ jobs: cp $workspace/publish/* Redis-7.0.13-Windows-x64/ mv Redis-7.0.13-Windows-x64 Redis-7.0.13-Windows-x64-with-Service tar -cvzf $workspace/Redis-7.0.13-Windows-x64-with-Service.tar.gz Redis-7.0.13-Windows-x64-with-Service/* + + windows-msys: + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/build-windows-msys.yml + with: + workflow: ${{ github.workflow }} + msys_install: gcc make pkg-config mingw-w64-x86_64-python libopenssl openssl-devel mingw-w64-x86_64-libc++ diff --git a/redis/build_msys.sh b/redis/build_msys.sh new file mode 100755 index 000000000..c073d77bb --- /dev/null +++ b/redis/build_msys.sh @@ -0,0 +1,51 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + + +tool_name="redis" +tool_version="7.2.1" +self_toolset_name="build-msys" +release_version_dirpath="$dp0/release/build" + +mkdir -p "$release_version_dirpath" && cd "$dp0/release" + +download_url="https://github.com/redis/redis/archive/refs/tags/$tool_version.tar.gz" +echo "::group::prepare sources $download_url" + +"$dp0/../.tools/download_bsdtar.sh" +bsdtar="$dp0/release/bsdtar" + +wget "$download_url" -O "tool-$tool_version.tar.gz" +"$bsdtar" -xf "tool-$tool_version.tar.gz" && cd "redis-$tool_version" + +echo "::endgroup::" + +echo "::group::build" + +make + +echo "::endgroup::" + +cp -f "./src/redis-cli" "$release_version_dirpath/" +cp -f "./src/redis-server" "$release_version_dirpath/" +cp -f "./src/redis-benchmark" "$release_version_dirpath/" +cp -f "./src/redis-sentinel" "$release_version_dirpath/" +cp -f "./src/redis-check-rdb" "$release_version_dirpath/" +cp -f "./src/redis-check-aof" "$release_version_dirpath/" + +cd "$release_version_dirpath" + +find . -mindepth 1 -maxdepth 1 -exec strip "{}" \; + +{ printf '### %s +%s + +SHA-256: %s + +' "$self_toolset_name.tar.gz" "$(./redis-cli --version)" "$(sha256sum ./*)" +} > "$self_toolset_name.md" + +cat "$self_toolset_name.md" + +"$bsdtar" -czvf "../$self_toolset_name.tar.gz" .