Skip to content

Commit

Permalink
Merge pull request #894 from jingjingxyk/experiment-feature
Browse files Browse the repository at this point in the history
Experiment feature
  • Loading branch information
jingjingxyk authored Dec 26, 2024
2 parents a79cca5 + 4787164 commit 5f46cbe
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 75 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/runner-images.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

[runner-images](https://github.com/actions/runner-images/tree/main/images)

[images](https://github.com/actions/runner-images/tree/main/images)
[available-images](https://github.com/actions/runner-images?tab=readme-ov-file#available-images)

[choosing-github-hosted-runners](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners)
17 changes: 14 additions & 3 deletions .github/workflows/windows-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
systeminfo | findstr /B /C:"Manufacturer" /C:"Product" /C:"Version"
env
set
ipconfig
uname -a
pwd
Expand Down Expand Up @@ -57,29 +57,40 @@ jobs:
# platform: x64
# packages: make wget tar libtool re2c bison gcc-g++ autoconf automake openssl libpcre2-devel libssl-devel libcurl-devel libxml2-devel libxslt-devel libgmp-devel ImageMagick libpng-devel libjpeg-devel libfreetype-devel libwebp-devel libsqlite3-devel zlib-devel libbz2-devel liblz4-devel liblzma-devel libzip-devel libicu-devel libonig-devel libcares-devel libsodium-devel libyaml-devel libMagick-devel libzstd-devel libbrotli-devel libreadline-devel libintl-devel libpq-devel libssh2-devel libidn2-devel gettext-devel coreutils openssl-devel zip unzip

- name: Install Cygwin Packages
- name: Install Cygwin Packages with bash
if: 0
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
ls -lah /cygdrive/c/
ls -lah /cygdrive/d/
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
bash ./sapi/scripts/cygwin/install-cygwin.sh
- name: Install Cygwin Packages
if: 1
run: |
Copy-Item -Path "C:\setup.exe" -Destination "${{ github.workspace }}\setup-x86_64.exe"
cmd /c .\sapi\quickstart\windows\cygwin-build\install-cygwin.bat
- name: Install re2c
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/install-re2c.sh
- name: Prepare
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
# git config --global --add safe.directory /cygdrive/d/a/swoole-cli/swoole-cli
# git submodule update --init
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh
- name: Configure
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/cygwin-config.sh
- name: Build
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/cygwin-build.sh
Expand Down Expand Up @@ -137,7 +148,7 @@ jobs:
files: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip

upload-to-cloud-object-storage:
if: 1
if: 0
runs-on: ubuntu-latest
needs: windows-cygwin
steps:
Expand Down
38 changes: 31 additions & 7 deletions docs/Cygwin.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,43 @@
> 命令行同时安装多个包,包名之间使用逗号隔开
## windows 环境下 配置 git 环境

1. 禁止Git在提交和检出时进行换行符的自动转换‌
2. 使用`lf` 作为换行符
3. 区分大小写

```shell

# 下载git
curl.exe -fSLo Git-2.47.1-64-bit.exe https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.1/Git-2.47.1-64-bit.exe

# 命令行静默安装 git
start /wait .\Git-2.47.1-64-bit.exe /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEONEXIT=1 /DIR="C:\Program Files\Git"


git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.ignorecase false

```

## 安装cygwin 和 cygwin 依赖项

> 打开 windows 控制台,并找到 setup-x86_64.exe 所在目录, 将 setup-x86_64.exe 复制到 `sapi\quickstart\windows\` 目录
> 执行如下命令
> 打开windows CMD 终端,进入项目目录 ,执行如下命令
```bash

# 自动安装 cygwin 和 cygwin 依赖项
sapi\quickstart\windows\install-cygwin.bat
.\sapi\quickstart\windows\cygwin-build\download-cygwin.bat
.\sapi\quickstart\windows\cygwin-build\install-cygwin.bat


```

构建步骤 - 执行的命令
====
> 运行如下步骤,需要先 打开 cygwin64 Terminal
> 运行如下步骤,打开 cygwin64 Terminal, 并进入项目目录,执行如下命令
```shell

Expand Down Expand Up @@ -122,14 +144,16 @@ libzstd-devel

## 安装 cygwin 和 安装 cygwin 依赖项 具体执行的命令

> `sapi\quickstart\windows\install-cygwin.bat` 脚本包含的内容
> 多个包之间 使用逗号分隔
> 编辑修改此文件即可 `.\sapi\quickstart\windows\cygwin-build\install-cygwin.bat`
```bash
# 安装 cygwin
setup-x86_64.exe --site https://mirrors.ustc.edu.cn/cygwin/
setup-x86_64.exe --site https://mirrors.ustc.edu.cn/cygwin/

# 安装 cygwin 依赖项
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip icu libicu-devel

Expand Down
19 changes: 9 additions & 10 deletions sapi/quickstart/linux/run-alpine-container-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cd ${__DIR__}

{
docker stop swoole-cli-alpine-dev
docker stop swoole-cli-builder
sleep 5
} || {
echo $?
Expand All @@ -21,7 +22,7 @@ cd ${__DIR__}

IMAGE=alpine:3.18

:<<'EOF'
: <<'EOF'
启动此容器
已经内置了 php 、composer 、 编译好的依赖库
Expand Down Expand Up @@ -51,31 +52,29 @@ case $ARCH in
'x86_64')
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-x86_64-20240715T132512Z
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
if [ "$MIRROR" = 'china' ] ; then
if [ "$MIRROR" = 'china' ]; then
IMAGE=registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:${TAG}
fi
;;
'aarch64')
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
if [ "$MIRROR" = 'china' ] ; then
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
fi
if [ "$MIRROR" = 'china' ]; then
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
fi
;;
*)
echo "${ARCH} 架构的容器 容器未配置"
exit 0
;;
esac


cd ${__DIR__}

if [ $DEV_SHM -eq 1 ] ; then
if [ $DEV_SHM -eq 1 ]; then
mkdir -p /dev/shm/swoole-cli/thirdparty/
mkdir -p /dev/shm/swoole-cli/ext/
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ -v /dev/shm/swoole-cli/ext/:/work/ext/ -w /work --init $IMAGE tail -f /dev/null
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ -v /dev/shm/swoole-cli/ext/:/work/ext/ -w /work --init $IMAGE tail -f /dev/null
else
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
fi

3 changes: 2 additions & 1 deletion sapi/quickstart/linux/run-alpine-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cd ${__DIR__}

{
docker stop swoole-cli-alpine-dev
docker stop swoole-cli-builder
sleep 5
} || {
echo $?
Expand All @@ -37,4 +38,4 @@ while [ $# -gt 0 ]; do
done

cd ${__DIR__}
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# windows 快速准备构建环境

## [windows cygwin 环境 构建步骤](../../../docs/Cygwin.md)
## [windows cygwin 环境 构建步骤](../../../../docs/Cygwin.md)

## 双击如下两个脚本,自动下载cygwin 和 cygwin安装依赖库

```shell

# 自动下载 cygwin
sapi\quickstart\windows\download-cygwin.bat
# 自动安装 cygwin
sapi\quickstart\windows\install-cygwin.bat
sapi\quickstart\windows\cygwin-build\download-cygwin.bat
# 自动安装 依赖包
sapi\quickstart\windows\cygwin-build\install-cygwin.bat


```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setlocal

echo %~dp0
cd /d %~dp0
cd /d ..\..\..\
cd /d ..\..\..\..\

set "__PROJECT__=%cd%"
echo %cd%
Expand All @@ -18,6 +18,6 @@ cd /d %__PROJECT__%\var\windows-cygwin-build-deps\

curl.exe -fSLo setup-x86_64.exe https://cygwin.com/setup-x86_64.exe

copy .\setup-x86_64.exe %__PROJECT__%\ /Y /Q
copy .\setup-x86_64.exe %__PROJECT__%\

endlocal
43 changes: 43 additions & 0 deletions sapi/quickstart/windows/cygwin-build/install-cygwin.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@echo off
:: cygwin site: https://cygwin.com/
:: start https://cygwin.com/setup-x86_64.exe

setlocal enableextensions enabledelayedexpansion


echo %~dp0
cd /d %~dp0
cd /d ..\..\..\..\

set "__PROJECT__=%cd%"
echo %cd%
:: package separate with commas

set SITE="https://mirrors.kernel.org/sourceware/cygwin/"

:getopt
if /i "%1" equ "--mirror" (
if /i "%2" equ "china" (
set SITE="https://mirrors.ustc.edu.cn/cygwin/"
)
)
shift

if not (%1)==() goto getopt

if "%GITHUB_ACTIONS%"=="" (
setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site %SITE%
)


setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages zip unzip

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages libpq5 libpq-devel

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages libzstd-devel



endlocal
24 changes: 0 additions & 24 deletions sapi/quickstart/windows/install-cygwin.bat

This file was deleted.

12 changes: 11 additions & 1 deletion sapi/scripts/cygwin/cygwin-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@ cd ${__PROJECT__}

mkdir -p bin/.libs
# export LDFLAGS="-all-static"
make -j $(nproc)

LOGICAL_PROCESSORS=$(nproc)

set +u
if [ -n "${GITHUB_ACTION}" ]; then
if test $LOGICAL_PROCESSORS -gt 2; then
LOGICAL_PROCESSORS=$((LOGICAL_PROCESSORS - 1))
fi
fi
set -u

make -j $LOGICAL_PROCESSORS
./bin/swoole-cli -v
./bin/swoole-cli -m
./bin/swoole-cli --ri swoole
4 changes: 2 additions & 2 deletions sapi/scripts/cygwin/install-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ while [ $# -gt 0 ]; do
shift $(($# > 0 ? 1 : 0))
done

# setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site http://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel,zip,unzip
# setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site http://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,zip,unzip
#setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site http://mirrors.ustc.edu.cn/cygwin/ --packages

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel,zip,unzip
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,zip,unzip
setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages zip unzip icu libicu-devel
setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages libpq5 libpq-devel
setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages libzstd-devel
Loading

0 comments on commit 5f46cbe

Please sign in to comment.