diff --git a/.github/workflows/zstd.yml b/.github/workflows/zstd.yml new file mode 100644 index 000000000..5d606052f --- /dev/null +++ b/.github/workflows/zstd.yml @@ -0,0 +1,63 @@ +name: zstd + +on: [pull_request, workflow_dispatch] + +jobs: + alpine-musl: + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/build-alpine.yml + with: + workflow: ${{ github.workflow }} + version: 3.18.4 + + test-alpine: + needs: alpine-musl + uses: ./.github/workflows/test-alpine.yml + with: + workflow: ${{ github.workflow }} + artifact: build-musl + + test-ubuntu: + needs: alpine-musl + uses: ./.github/workflows/test-ubuntu.yml + with: + workflow: ${{ github.workflow }} + artifact: build-musl + + windows-mingw: + if: ${{ vars.CURRENT_TOOL == github.workflow }} + uses: ./.github/workflows/build-windows-msys2.yml + with: + workflow: ${{ github.workflow }} + msys2_install: make mingw-w64-x86_64-gcc + toolset: mingw + + test-windows: + needs: windows-mingw + uses: ./.github/workflows/test-windows.yml + with: + workflow: ${{ github.workflow }} + artifact: build-mingw + + test-nanoserver: + needs: windows-mingw + uses: ./.github/workflows/test-nanoserver.yml + with: + workflow: ${{ github.workflow }} + artifact: build-mingw + + release: + needs: [test-alpine, + test-ubuntu, + test-windows, + test-nanoserver] + uses: ./.github/workflows/release.yml + with: + workflow: ${{ github.workflow }} + tool_version: '1.5.5' + prepare_body: | + bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md + bsdtar -Oxf ./build-mingw/build-mingw.tar.gz build-mingw.md >> body.md + artifacts: ./build-musl/build-musl.tar.gz,./build-mingw/build-mingw.tar.gz + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 1ca51fdf2..ea5d4902e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/ansible-8.3.0/total?label=⭳%20ansible-8.3.0-core-2.15.3)](https://github.com/hemnstill/StandaloneTools/releases/tag/ansible-8.3.0) | [![GitHub Repo stars](https://img.shields.io/github/stars/ansible/ansible?style=social&label=ansible)](https://github.com/ansible/ansible) [![PyPI](https://img.shields.io/pypi/v/ansible)](https://pypi.org/project/ansible/) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/ansible/ansible)](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/bsdtar-3.7.1/total?label=⭳%20bsdtar-3.7.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/bsdtar-3.7.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/libarchive/libarchive?style=social&label=libarchive)](https://github.com/libarchive/libarchive) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/libarchive/libarchive)](https://github.com/libarchive/libarchive/releases/latest) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/7-Zip-23.01/total?label=⭳%207-Zip-23.01)](https://github.com/hemnstill/StandaloneTools/releases/tag/7-Zip-23.01) | [![SourceForge Downloads](https://img.shields.io/sourceforge/dm/sevenzip?style=social&label=7-Zip)](https://sourceforge.net/projects/sevenzip/) | +| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/zstd-1.5.5/total?label=⭳%20zstd-1.5.5)](https://github.com/hemnstill/StandaloneTools/releases/tag/zstd-1.5.5) | [![GitHub Repo stars](https://img.shields.io/github/stars/facebook/zstd?style=social&label=zstd)](https://github.com/facebook/zstd) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/facebook/zstd)](https://github.com/facebook/zstd/releases/latest) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/pg_dump-15.1/total?label=⭳%20pg_dump-15.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/pg_dump-15.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/postgres/postgres?style=social&label=postgres)](https://github.com/postgres/postgres) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/postgres/postgres)](https://www.postgresql.org/docs/current/index.html) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/mysql-8.0.33/total?label=⭳%20mysql-8.0.33)](https://github.com/hemnstill/StandaloneTools/releases/tag/mysql-8.0.33) | [![GitHub Repo stars](https://img.shields.io/github/stars/mysql/mysql-server?style=social&label=mysql-server)](https://github.com/mysql/mysql-server) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/mysql/mysql-server)](https://dev.mysql.com/doc/relnotes/mysql/en/) | | [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/redis-7.0.13/total?label=⭳%20redis-7.0.13)](https://github.com/hemnstill/StandaloneTools/releases/tag/redis-7.0.13) | [![GitHub Repo stars](https://img.shields.io/github/stars/redis/redis?style=social&label=redis)](https://github.com/redis/redis) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/redis/redis)](https://redis.io/download/) | diff --git a/zstd/build_mingw.sh b/zstd/build_mingw.sh new file mode 100755 index 000000000..786b5f2e0 --- /dev/null +++ b/zstd/build_mingw.sh @@ -0,0 +1,53 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + +tool_name="zstd" +tool_version="1.5.5" +tool_zlib_version="1.3" +self_toolset_name="build-mingw" + +download_url="https://github.com/facebook/zstd/archive/refs/tags/v$tool_version.tar.gz" +echo "::group::prepare sources $download_url" + +mkdir -p "$dp0/release/build" && cd "$dp0/release" + +"$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" + +echo "::endgroup::" + +echo "::group::build" + +download_url_zlib="https://github.com/madler/zlib/archive/refs/tags/v$tool_zlib_version.tar.gz" +wget "$download_url_zlib" -O "zlib_tool-$tool_zlib_version.tar.gz" +"$bsdtar" -xf "zlib_tool-$tool_zlib_version.tar.gz" + +make -C "zlib-$tool_zlib_version" -f win32/Makefile.gcc libz.a + +cd "$dp0/release/$tool_name-$tool_version" +export CPPFLAGS=-I"$dp0/release/zlib-$tool_zlib_version" +export LDFLAGS="$dp0/release/zlib-$tool_zlib_version/libz.a" +make -j allzstd MOREFLAGS=-static V=1 + +echo "::endgroup::" + +cp -f "./programs/$tool_name.exe" "$dp0/release/build/" + +cd "$dp0/release/build" + +{ printf '### %s +SHA-256: %s +%s + + +%s +' "$self_toolset_name.tar.gz" "$(sha256sum $tool_name)" "$download_url_zlib" "$download_url" +} > "$self_toolset_name.md" + +cat "$self_toolset_name.md" + +tar -czvf "../$self_toolset_name.tar.gz" . diff --git a/zstd/build_musl.sh b/zstd/build_musl.sh new file mode 100755 index 000000000..dc8545abd --- /dev/null +++ b/zstd/build_musl.sh @@ -0,0 +1,49 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + +echo "::group::install deps" + +apk update +apk add --no-cache alpine-sdk cmake zlib-dev zlib-static + +echo "::endgroup::" + +tool_name="zstd" +tool_version="1.5.5" +self_toolset_name="build-musl" + +download_url="https://github.com/facebook/zstd/archive/refs/tags/v$tool_version.tar.gz" +echo "::group::prepare sources $download_url" + +mkdir -p "$dp0/release/build" && cd "$dp0/release" +wget "$download_url" -O "tool-$tool_version.tar.gz" +tar -xf "tool-$tool_version.tar.gz" && cd "$tool_name-$tool_version" + +echo "::endgroup::" + +echo "::group::build" + +cmake build/cmake -DZSTD_BUILD_STATIC=ON -DZSTD_USE_STATIC_RUNTIME=ON -DZSTD_BUILD_TESTS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" +cmake --build . + +echo "::endgroup::" + +cp -f "./programs/$tool_name" "$dp0/release/build/" + +cd "$dp0/release/build" + +strip "$tool_name" + +{ printf '%s + +### %s +SHA-256: %s + +%s +' "$("./$tool_name" --version)" "$self_toolset_name.tar.gz" "$(sha256sum $tool_name)" "$(apk info zlib-static --webpage)" +} > "$self_toolset_name.md" + +cat "$self_toolset_name.md" + +tar -czvf "../$self_toolset_name.tar.gz" . diff --git a/zstd/test_linux.sh b/zstd/test_linux.sh new file mode 100755 index 000000000..560a0d1ee --- /dev/null +++ b/zstd/test_linux.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +testVersion() { + assertEquals "*** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***" "$(../bin/zstd --version)" +} + +# Load and run shUnit2. +source "../.tests/shunit2/shunit2" diff --git a/zstd/test_windows.sh b/zstd/test_windows.sh new file mode 100755 index 000000000..40b06c5b8 --- /dev/null +++ b/zstd/test_windows.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +testVersion() { + assertEquals "*** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***" "$(../bin/zstd.exe --version)" +} + +# Load and run shUnit2. +source "../.tests/shunit2/shunit2"