From b8cfa4096e1f7b291a183a36819aa44338f6632f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=BD=E5=90=A7=EF=BC=8C=E4=BD=A0=E6=83=B3=E8=AF=B4?= =?UTF-8?q?=E5=95=A5?= Date: Mon, 16 Dec 2024 23:19:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=94=9F=E6=88=90=20artifacts=20hash=20(#8?= =?UTF-8?q?57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * generate artifacts sha256sum * 生成指定版本的 hash * 生成指定版本的 hash * 生成指定版本的 hash * 生成 发版 hash * fix 生成 发版 hash * update generate artifact hash script * update artifact-hash.yaml * optimize generate artifact hash * optimize generate artifact --- .github/workflows/artifact-hash.yml | 27 ++++++ ext/swoole | 2 +- sapi/scripts/generate-artifact-hash.sh | 120 +++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/artifact-hash.yml create mode 100644 sapi/scripts/generate-artifact-hash.sh diff --git a/.github/workflows/artifact-hash.yml b/.github/workflows/artifact-hash.yml new file mode 100644 index 0000000000..874f1c7e5a --- /dev/null +++ b/.github/workflows/artifact-hash.yml @@ -0,0 +1,27 @@ +name: artifact-hash + +on: + workflow_dispatch: + inputs: + version: + required: true + description: "发版 版本号 tag" + default: 'v5.1.6.0' + type: string + +jobs: + generate-artifact-hash: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Show Release File Hash + run: | + bash sapi/scripts/generate-artifact-hash.sh --version ${{ inputs.version }} + + - name: production artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.version }}-sha256sum + retention-days: 90 + path: | + ${{ inputs.version }}-sha256sum diff --git a/ext/swoole b/ext/swoole index 709a5cd1e2..67ad28a269 160000 --- a/ext/swoole +++ b/ext/swoole @@ -1 +1 @@ -Subproject commit 709a5cd1e2b2a20e74576f85445668e155ce549a +Subproject commit 67ad28a269c0c9f6f990c035240ebdfa092a1103 diff --git a/sapi/scripts/generate-artifact-hash.sh b/sapi/scripts/generate-artifact-hash.sh new file mode 100644 index 0000000000..f3497522ba --- /dev/null +++ b/sapi/scripts/generate-artifact-hash.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +set -xu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=$( + cd ${__DIR__}/../../ + pwd +) + +cd ${__PROJECT__} + +OS=$(uname -s) +case $OS in +'Linux') + OS="linux" + ;; +'Darwin') + OS="macos" + ;; +*) + case $OS in + 'MSYS_NT'*) + OS="windows" + ;; + 'MINGW64_NT'*) + OS="windows" + ;; + *) + echo '暂未配置的 OS ' + exit 0 + ;; + esac + ;; +esac + +APP_VERSION='v5.1.6' +APP_NAME='swoole-cli' +VERSION='v5.1.6.0' + +while [ $# -gt 0 ]; do + case "$1" in + --proxy) + export HTTP_PROXY="$2" + export HTTPS_PROXY="$2" + NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16" + NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8" + NO_PROXY="${NO_PROXY},localhost" + export NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com" + ;; + --version) + # 指定发布 TAG + if [ $OS = "macos" ]; then + X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') + X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}') + elif [ $OS = "linux" ]; then + OS_RELEASE=$(awk -F= '/^ID=/{print $2}' /etc/os-release | tr -d '\n' | tr -d '\"') + if [ "$OS_RELEASE" = 'alpine' ]; then + X_VERSION=$(echo "$2" | egrep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') + X_APP_VERSION=$(echo "$2" | egrep -Eo '^v\d\.\d{1,2}\.\d{1,2}') + else + X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') + X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}') + fi + + else + X_VERSION='' + X_APP_VERSION='' + fi + + if [[ -n $X_VERSION ]] && [[ -n $X_APP_VERSION ]]; then + { + VERSION=$X_VERSION + APP_VERSION=$X_APP_VERSION + } + else + { + echo '--version vx.x.x error !' + exit 0 + } + fi + ;; + --*) + echo "Illegal option $1" + exit 0 + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + +mkdir -p ${__PROJECT__}/var/artifact-hash/${VERSION} +cd ${__PROJECT__}/var/artifact-hash/${VERSION} + +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME() { + OS="$1" + ARCH="$2" + + APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" + APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}" + test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL} + +} + +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "linux" "x64" +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "linux" "arm64" +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "macos" "x64" +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "macos" "arm64" + +ARCH="x64" +APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip" + +APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" +test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} +test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/v5.1.5.1/all-deps.zip + +ls -p | grep -v '/$' | xargs sha256sum + +ls -p | grep -v '/$' | xargs sha256sum >${__PROJECT__}/${VERSION}-sha256sum From 25c6b093d80e0dffba3c70f4d89ffeb5d491cc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=BD=E5=90=A7=EF=BC=8C=E4=BD=A0=E6=83=B3=E8=AF=B4?= =?UTF-8?q?=E5=95=A5?= Date: Tue, 17 Dec 2024 07:17:07 +0800 Subject: [PATCH 2/4] fix bug (#870) --- ext/swoole | 2 +- sapi/scripts/generate-artifact-hash.sh | 2 +- setup-swoole-cli-runtime.sh | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ext/swoole b/ext/swoole index 67ad28a269..3e1a1f8993 160000 --- a/ext/swoole +++ b/ext/swoole @@ -1 +1 @@ -Subproject commit 67ad28a269c0c9f6f990c035240ebdfa092a1103 +Subproject commit 3e1a1f89930ba0bbea1f5ee31bcd0ee701a87aab diff --git a/sapi/scripts/generate-artifact-hash.sh b/sapi/scripts/generate-artifact-hash.sh index f3497522ba..4de2b17ac2 100644 --- a/sapi/scripts/generate-artifact-hash.sh +++ b/sapi/scripts/generate-artifact-hash.sh @@ -113,7 +113,7 @@ APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSI APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} -test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/v5.1.5.1/all-deps.zip +test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip ls -p | grep -v '/$' | xargs sha256sum diff --git a/setup-swoole-cli-runtime.sh b/setup-swoole-cli-runtime.sh index 8c3e378e27..6c06390472 100644 --- a/setup-swoole-cli-runtime.sh +++ b/setup-swoole-cli-runtime.sh @@ -74,8 +74,14 @@ while [ $# -gt 0 ]; do X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}') elif [ $OS = "linux" ]; then - X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') - X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}') + OS_RELEASE=$(awk -F= '/^ID=/{print $2}' /etc/os-release | tr -d '\n' | tr -d '\"') + if [ "$OS_RELEASE" = 'alpine' ]; then + X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') + X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}') + else + X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}\.\d{1,2}$') + X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}') + fi else X_VERSION='' X_APP_VERSION='' From e9cad59c51881cd2825abd7ac166dd159fbf60eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=BD=E5=90=A7=EF=BC=8C=E4=BD=A0=E6=83=B3=E8=AF=B4?= =?UTF-8?q?=E5=95=A5?= Date: Tue, 17 Dec 2024 07:17:22 +0800 Subject: [PATCH 3/4] upgrade swoole version to v6.0.0 (#869) From f4d4d731a33a934fd81a9aedc0dfcedc5b5230e8 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 19 Dec 2024 00:11:57 +0800 Subject: [PATCH 4/4] default swoole version upgrade to v6.0.0 --- sapi/scripts/generate-artifact-hash.sh | 7 +------ sapi/src/builder/extension/swoole.php | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/sapi/scripts/generate-artifact-hash.sh b/sapi/scripts/generate-artifact-hash.sh index 53d291e5ec..fe91d30c83 100644 --- a/sapi/scripts/generate-artifact-hash.sh +++ b/sapi/scripts/generate-artifact-hash.sh @@ -142,7 +142,7 @@ WINDOWS_DOWNLOAD_SWOOLE_CLIE_RUNTIME() { APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} - test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${X_VERSION}/all-deps.zip + test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip } WINDOWS_DOWNLOAD() { @@ -168,11 +168,6 @@ DOWNLOAD() { } DOWNLOAD -======= -APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" -test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} -test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip ->>>>>>> experiment-feature-new ls -p | grep -v '/$' | xargs sha256sum diff --git a/sapi/src/builder/extension/swoole.php b/sapi/src/builder/extension/swoole.php index 865a52cb5b..5bf826d904 100644 --- a/sapi/src/builder/extension/swoole.php +++ b/sapi/src/builder/extension/swoole.php @@ -9,20 +9,18 @@ $dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql']; $dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo']; - $swoole_tag = 'v5.1.6'; - if (BUILD_CUSTOM_PHP_VERSION_ID >= 8040) { - // v5.1.x 不支持 PHP 8.4 - // swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92 - $swoole_tag = 'master'; - $options[] = '--enable-swoole-thread'; - $options[] = '--enable-zts'; - $options[] = '--disable-opcache-jit'; - $options[] = '--enable-brotli'; - $options[] = '--enable-zstd'; - $dependentLibraries[] = 'libzstd'; - $p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)'); - $p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)'); - } + // v5.1.x 不支持 PHP 8.4 + // swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92 + $swoole_tag = 'v6.0.0'; + $options[] = '--enable-swoole-thread'; + $options[] = '--enable-zts'; + $options[] = '--disable-opcache-jit'; + $options[] = '--enable-brotli'; + $options[] = '--enable-zstd'; + $dependentLibraries[] = 'libzstd'; + $p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)'); + $p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)'); + $file = "swoole-{$swoole_tag}.tar.gz"; $url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz";