Skip to content

Commit 0adfcb2

Browse files
committed
merge code
2 parents 348a9cf + 5f46cbe commit 0adfcb2

File tree

16 files changed

+147
-75
lines changed

16 files changed

+147
-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
@@ -27,7 +27,7 @@ jobs:
2727
systeminfo
2828
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
2929
systeminfo | findstr /B /C:"Manufacturer" /C:"Product" /C:"Version"
30-
env
30+
set
3131
ipconfig
3232
uname -a
3333
pwd
@@ -75,29 +75,40 @@ jobs:
7575
# platform: x64
7676
# 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
7777

78-
- name: Install Cygwin Packages
78+
- name: Install Cygwin Packages with bash
79+
if: 0
7980
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
8081
run: |
8182
ls -lah /cygdrive/c/
8283
ls -lah /cygdrive/d/
8384
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
8485
bash ./sapi/scripts/cygwin/install-cygwin.sh
8586

87+
- name: Install Cygwin Packages
88+
if: 1
89+
run: |
90+
Copy-Item -Path "C:\setup.exe" -Destination "${{ github.workspace }}\setup-x86_64.exe"
91+
cmd /c .\sapi\quickstart\windows\cygwin-build\install-cygwin.bat
92+
8693
- name: Install re2c
94+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
8795
run: |
8896
bash ./sapi/scripts/cygwin/install-re2c.sh
8997

9098
- name: Prepare
99+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
91100
run: |
92101
# git config --global --add safe.directory /cygdrive/d/a/swoole-cli/swoole-cli
93102
# git submodule update --init
94103
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }}
95104

96105
- name: Configure
106+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
97107
run: |
98108
bash ./sapi/scripts/cygwin/cygwin-config.sh --php-version ${{ env.BUILD_PHP_VERSION }}
99109

100110
- name: Build
111+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
101112
run: |
102113
bash ./sapi/scripts/cygwin/cygwin-build.sh
103114

@@ -157,7 +168,7 @@ jobs:
157168
files: php-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip
158169

159170
upload-to-cloud-object-storage:
160-
if: 1
171+
if: 0
161172
runs-on: ubuntu-latest
162173
needs: windows-cygwin
163174
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 、 编译好的依赖库
@@ -52,31 +53,29 @@ case $ARCH in
5253
'x86_64')
5354
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-x86_64-20240715T132512Z
5455
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
55-
if [ "$MIRROR" = 'china' ] ; then
56+
if [ "$MIRROR" = 'china' ]; then
5657
IMAGE=registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:${TAG}
5758
fi
5859
;;
5960
'aarch64')
6061
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
6162
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
62-
if [ "$MIRROR" = 'china' ] ; then
63-
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
64-
fi
63+
if [ "$MIRROR" = 'china' ]; then
64+
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
65+
fi
6566
;;
6667
*)
6768
echo "此 ${ARCH} 架构的容器 容器未配置"
6869
exit 0
6970
;;
7071
esac
7172

72-
7373
cd ${__DIR__}
7474

75-
if [ $DEV_SHM -eq 1 ] ; then
75+
if [ $DEV_SHM -eq 1 ]; then
7676
mkdir -p /dev/shm/swoole-cli/thirdparty/
7777
mkdir -p /dev/shm/swoole-cli/ext/
78-
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
78+
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
7979
else
80-
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
80+
docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
8181
fi
82-

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: 1 addition & 1 deletion
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%
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 & 25 deletions
This file was deleted.

sapi/scripts/cygwin/cygwin-build.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ cd ${__PROJECT__}/php-src
1414

1515
mkdir -p bin/.libs
1616

17-
make -j $(nproc) cli
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 cli
1828

1929
${__PROJECT__}/php-src/sapi/cli/php.exe -v
2030

2131
cp -f ${__PROJECT__}/php-src/sapi/cli/php.exe ${__PROJECT__}/bin/
2232

23-
2433
${__PROJECT__}/bin/php.exe -v
2534
${__PROJECT__}/bin/php.exe -m
2635
${__PROJECT__}/bin/php.exe --ri swoole

0 commit comments

Comments
 (0)