Skip to content

Commit 5f46cbe

Browse files
authored
Merge pull request #894 from jingjingxyk/experiment-feature
Experiment feature
2 parents a79cca5 + 4787164 commit 5f46cbe

File tree

16 files changed

+148
-75
lines changed

16 files changed

+148
-75
lines changed

.github/workflows/runner-images.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
21
[runner-images](https://github.com/actions/runner-images/tree/main/images)
32

4-
[images](https://github.com/actions/runner-images/tree/main/images)
3+
[available-images](https://github.com/actions/runner-images?tab=readme-ov-file#available-images)
4+
5+
[choosing-github-hosted-runners](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners)

.github/workflows/windows-cygwin.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
systeminfo
1616
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
1717
systeminfo | findstr /B /C:"Manufacturer" /C:"Product" /C:"Version"
18-
env
18+
set
1919
ipconfig
2020
uname -a
2121
pwd
@@ -57,29 +57,40 @@ jobs:
5757
# platform: x64
5858
# 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
5959

60-
- name: Install Cygwin Packages
60+
- name: Install Cygwin Packages with bash
61+
if: 0
6162
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
6263
run: |
6364
ls -lah /cygdrive/c/
6465
ls -lah /cygdrive/d/
6566
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
6667
bash ./sapi/scripts/cygwin/install-cygwin.sh
6768
69+
- name: Install Cygwin Packages
70+
if: 1
71+
run: |
72+
Copy-Item -Path "C:\setup.exe" -Destination "${{ github.workspace }}\setup-x86_64.exe"
73+
cmd /c .\sapi\quickstart\windows\cygwin-build\install-cygwin.bat
74+
6875
- name: Install re2c
76+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
6977
run: |
7078
bash ./sapi/scripts/cygwin/install-re2c.sh
7179
7280
- name: Prepare
81+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
7382
run: |
7483
# git config --global --add safe.directory /cygdrive/d/a/swoole-cli/swoole-cli
7584
# git submodule update --init
7685
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh
7786
7887
- name: Configure
88+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
7989
run: |
8090
bash ./sapi/scripts/cygwin/cygwin-config.sh
8191
8292
- name: Build
93+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
8394
run: |
8495
bash ./sapi/scripts/cygwin/cygwin-build.sh
8596
@@ -137,7 +148,7 @@ jobs:
137148
files: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip
138149

139150
upload-to-cloud-object-storage:
140-
if: 1
151+
if: 0
141152
runs-on: ubuntu-latest
142153
needs: windows-cygwin
143154
steps:

docs/Cygwin.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,43 @@
1212
1313
> 命令行同时安装多个包,包名之间使用逗号隔开
1414
15+
## windows 环境下 配置 git 环境
16+
17+
1. 禁止Git在提交和检出时进行换行符的自动转换‌
18+
2. 使用`lf` 作为换行符
19+
3. 区分大小写
20+
21+
```shell
22+
23+
# 下载git
24+
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
25+
26+
# 命令行静默安装 git
27+
start /wait .\Git-2.47.1-64-bit.exe /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEONEXIT=1 /DIR="C:\Program Files\Git"
28+
29+
30+
git config --global core.autocrlf false
31+
git config --global core.eol lf
32+
git config --global core.ignorecase false
33+
34+
```
35+
1536
## 安装cygwin 和 cygwin 依赖项
1637

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

2242
# 自动安装 cygwin 和 cygwin 依赖项
23-
sapi\quickstart\windows\install-cygwin.bat
43+
.\sapi\quickstart\windows\cygwin-build\download-cygwin.bat
44+
.\sapi\quickstart\windows\cygwin-build\install-cygwin.bat
45+
2446

2547
```
2648

2749
构建步骤 - 执行的命令
2850
====
29-
> 运行如下步骤,需要先 打开 cygwin64 Terminal
51+
> 运行如下步骤,打开 cygwin64 Terminal, 并进入项目目录,执行如下命令
3052
3153
```shell
3254

@@ -122,14 +144,16 @@ libzstd-devel
122144

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

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

131155
# 安装 cygwin 依赖项
132-
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
156+
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
133157

134158
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
135159

sapi/quickstart/linux/run-alpine-container-full.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cd ${__DIR__}
1313

1414
{
1515
docker stop swoole-cli-alpine-dev
16+
docker stop swoole-cli-builder
1617
sleep 5
1718
} || {
1819
echo $?
@@ -21,7 +22,7 @@ cd ${__DIR__}
2122

2223
IMAGE=alpine:3.18
2324

24-
:<<'EOF'
25+
: <<'EOF'
2526
启动此容器
2627
2728
已经内置了 php 、composer 、 编译好的依赖库
@@ -51,31 +52,29 @@ case $ARCH in
5152
'x86_64')
5253
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-x86_64-20240715T132512Z
5354
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
54-
if [ "$MIRROR" = 'china' ] ; then
55+
if [ "$MIRROR" = 'china' ]; then
5556
IMAGE=registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:${TAG}
5657
fi
5758
;;
5859
'aarch64')
5960
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
6061
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
61-
if [ "$MIRROR" = 'china' ] ; then
62-
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
63-
fi
62+
if [ "$MIRROR" = 'china' ]; then
63+
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
64+
fi
6465
;;
6566
*)
6667
echo "${ARCH} 架构的容器 容器未配置"
6768
exit 0
6869
;;
6970
esac
7071

71-
7272
cd ${__DIR__}
7373

74-
if [ $DEV_SHM -eq 1 ] ; then
74+
if [ $DEV_SHM -eq 1 ]; then
7575
mkdir -p /dev/shm/swoole-cli/thirdparty/
7676
mkdir -p /dev/shm/swoole-cli/ext/
77-
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
77+
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
7878
else
79-
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
79+
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
8080
fi
81-

sapi/quickstart/linux/run-alpine-container.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cd ${__DIR__}
1313

1414
{
1515
docker stop swoole-cli-alpine-dev
16+
docker stop swoole-cli-builder
1617
sleep 5
1718
} || {
1819
echo $?
@@ -37,4 +38,4 @@ while [ $# -gt 0 ]; do
3738
done
3839

3940
cd ${__DIR__}
40-
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
41+
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null

sapi/quickstart/windows/README.md renamed to sapi/quickstart/windows/cygwin-build/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# windows 快速准备构建环境
22

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

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

77
```shell
88

99
# 自动下载 cygwin
10-
sapi\quickstart\windows\download-cygwin.bat
11-
# 自动安装 cygwin
12-
sapi\quickstart\windows\install-cygwin.bat
10+
sapi\quickstart\windows\cygwin-build\download-cygwin.bat
11+
# 自动安装 依赖包
12+
sapi\quickstart\windows\cygwin-build\install-cygwin.bat
1313

1414

1515
```

sapi/quickstart/windows/download-cygwin.bat renamed to sapi/quickstart/windows/cygwin-build/download-cygwin.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ setlocal
77

88
echo %~dp0
99
cd /d %~dp0
10-
cd /d ..\..\..\
10+
cd /d ..\..\..\..\
1111

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

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

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

2323
endlocal
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@echo off
2+
:: cygwin site: https://cygwin.com/
3+
:: start https://cygwin.com/setup-x86_64.exe
4+
5+
setlocal enableextensions enabledelayedexpansion
6+
7+
8+
echo %~dp0
9+
cd /d %~dp0
10+
cd /d ..\..\..\..\
11+
12+
set "__PROJECT__=%cd%"
13+
echo %cd%
14+
:: package separate with commas
15+
16+
set SITE="https://mirrors.kernel.org/sourceware/cygwin/"
17+
18+
:getopt
19+
if /i "%1" equ "--mirror" (
20+
if /i "%2" equ "china" (
21+
set SITE="https://mirrors.ustc.edu.cn/cygwin/"
22+
)
23+
)
24+
shift
25+
26+
if not (%1)==() goto getopt
27+
28+
if "%GITHUB_ACTIONS%"=="" (
29+
setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site %SITE%
30+
)
31+
32+
33+
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
34+
35+
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages zip unzip
36+
37+
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages libpq5 libpq-devel
38+
39+
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages libzstd-devel
40+
41+
42+
43+
endlocal

sapi/quickstart/windows/install-cygwin.bat

Lines changed: 0 additions & 24 deletions
This file was deleted.

sapi/scripts/cygwin/cygwin-build.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ cd ${__PROJECT__}
1313

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

17+
LOGICAL_PROCESSORS=$(nproc)
18+
19+
set +u
20+
if [ -n "${GITHUB_ACTION}" ]; then
21+
if test $LOGICAL_PROCESSORS -gt 2; then
22+
LOGICAL_PROCESSORS=$((LOGICAL_PROCESSORS - 1))
23+
fi
24+
fi
25+
set -u
26+
27+
make -j $LOGICAL_PROCESSORS
1828
./bin/swoole-cli -v
1929
./bin/swoole-cli -m
2030
./bin/swoole-cli --ri swoole

0 commit comments

Comments
 (0)