Skip to content

Commit

Permalink
merge code
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjingxyk committed Dec 26, 2024
2 parents 7cb0bd8 + d760c88 commit 428ba44
Show file tree
Hide file tree
Showing 21 changed files with 162 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/artifact-hash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
version:
required: true
description: "发版 版本号 tag"
default: 'v1.6.0'
default: 'v1.7.1'
type: string
php-version:
required: true
Expand Down
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 @@ -27,7 +27,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 @@ -75,29 +75,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 --php-version ${{ env.BUILD_PHP_VERSION }}
- name: Configure
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/cygwin-config.sh --php-version ${{ env.BUILD_PHP_VERSION }}
- 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 @@ -157,7 +168,7 @@ jobs:
files: php-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
23 changes: 6 additions & 17 deletions sapi/quickstart/build-native-php-example.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/bin/env bash
set -uex


OS=$(uname -s)
ARCH=$(uname -m)


export CC=clang
export CXX=clang++
export LD=ld.lld

if [ "$OS" = 'Linux' ] ;then
if [ "$OS" = 'Linux' ]; then

: <<'EOF'
: <<'EOF'
# setup container environment
docker run --rm -ti --init -v .:/work -w /work debian:11
Expand All @@ -24,15 +22,12 @@ EOF

fi

if [ "$OS" = 'Darwin' ]; then

if [ "$OS" = 'Darwin' ] ;then

export PATH=/usr/local/opt/bison/bin/:/usr/local/opt/llvm/bin/:$PATH
export PATH=/usr/local/opt/bison/bin/:/usr/local/opt/llvm/bin/:$PATH

fi



mkdir -p /tmp/t
cd /tmp/t

Expand All @@ -53,10 +48,6 @@ tar --strip-components=1 -C mongodb -xf mongodb-${MONGODB_VERSION}.tgz
test -d php-src/ext/mongodb && rm -rf php-src/ext/mongodb
mv mongodb php-src/ext/





cd php-src

./buildconf --force
Expand All @@ -83,13 +74,11 @@ cd php-src

make -j $(nproc)


if [ "$OS" = 'Linux' ] ;then
if [ "$OS" = 'Linux' ]; then

file sapi/cli/php
readelf -h sapi/cli/php

else
otool -L sapi/cli/php
otool -L sapi/cli/php
fi

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 @@ -52,31 +53,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
43 changes: 0 additions & 43 deletions sapi/quickstart/windows/README.md

This file was deleted.

23 changes: 23 additions & 0 deletions sapi/quickstart/windows/cygwin-build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# windows 快速准备构建环境

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

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

```shell

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


```

# windows 软连接例子

```bash

mklink composer composer.phar

```
2 changes: 1 addition & 1 deletion sapi/quickstart/windows/cygwin-build/download-cygwin.bat
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 Down
Loading

0 comments on commit 428ba44

Please sign in to comment.