Skip to content

Commit

Permalink
Merge pull request #660 from jingjingxyk/experiment-quickstart
Browse files Browse the repository at this point in the history
 合并 主分支 待合并 变更
  • Loading branch information
jingjingxyk committed Jun 18, 2024
2 parents 6193e68 + 9b2f294 commit 21be0c8
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: prepare pre-built library
uses: addnab/docker-run-action@v3
with:
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240106T114724Z
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/tmp/
run: |
for i in `ls /usr/local/swoole-cli/`
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +uuid --with-build-type=release --with-libavif=1
bash make-install-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +uuid --with-build-type=release --with-libavif=1
bash make-install-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid --with-build-type=release --with-libavif=1
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid --with-build-type=release --with-libavif=1
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if [ "$OS" = 'linux' ] ; then
if [ ! "$BASH_VERSION" ] ; then
echo "Please use bash to run this script ($0) " 1>&2
echo "fix : " 1>&2
echo "apk add bash' or sh sapi/quickstart/linux/alpine-init.sh " 1>&2
echo "apk add bash OR sh sapi/quickstart/linux/alpine-init-mini.sh " 1>&2
exit 1
fi
fi
Expand Down
52 changes: 52 additions & 0 deletions docs/extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# support extensions (x64)

| extension name | linux6 | macos | windows(cygwin) | default enabled |
|----------------|--------|-------|-----------------|-----------------|
| curl |||||
| iconv |||||
| bcmath |||||
| pcntl |||||
| filter |||||
| session |||||
| tokenizer |||||
| mbstring |||||
| ctype |||||
| zlib |||||
| zip |||||
| posix |||||
| sockets |||||
| pdo |||||
| sqlite3 |||||
| phar |||||
| mysqlnd |||||
| mysqli |||||
| intl |||||
| fileinfo |||||
| pdo_mysql |||||
| soap |||||
| xsl |||||
| gmp |||||
| exif |||||
| sodium |||||
| openssl |||||
| readline |||||
| libxml |||||
| xml |||||
| xmlreader |||||
| xmlwriter |||||
| dom |||||
| simplexml |||||
| redis |||||
| yaml |||||
| imagick |||||
| gd |||||
| opcache |||||
| swoole |||||
| ssh2 |||||
| apcu |||||
| ds |||||
| inotify |||||
| protobuf |||||
| uuid |||||


6 changes: 6 additions & 0 deletions docs/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid
bash ./make.sh docker-build
bash ./make.sh docker-bash

# 准备bash 命令
sh sapi/quickstart/linux/alpine-init-minimal.sh

bash sapi/quickstart/linux/alpine-init.sh

# 进入容器后需要再一次执行此命令
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid

bash make-install-deps.sh

bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
Expand Down
4 changes: 3 additions & 1 deletion docs/macOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ bash setup-php-runtime.sh
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile

php prepare.php --without-docker=1 +inotify +apcu +ds +xlswriter +ssh2 +uuid
php prepare.php --without-docker=1 +apcu +ds +xlswriter +ssh2 +uuid

bash sapi/quickstart/macos/macos-init.sh

bash make-install-deps.sh

bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RUN composer update --optimize-autoloader
RUN composer config -g --unset repos.packagist


RUN php prepare.php --with-swoole-pgsql=1 --with-libavif=1
RUN php prepare.php +apcu +ds +xlswriter +ssh2 +uuid --with-libavif=1

RUN bash make-install-deps.sh

Expand Down
7 changes: 5 additions & 2 deletions sapi/quickstart/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ bash sapi/quickstart/linux/run-alpine-container.sh
# 进入容器
bash sapi/quickstart/linux/connection-swoole-cli-alpine.sh

# 准备构建基础软件 bash git
sh sapi/quickstart/linux/alpine-init-minimal.sh

# 准备构建基础软件
sh sapi/quickstart/linux/alpine-init.sh
bash sapi/quickstart/linux/alpine-init.sh

# 准备构建基础软件 使用中科大镜像源
sh sapi/quickstart/linux/alpine-init.sh --mirror china
bash sapi/quickstart/linux/alpine-init.sh --mirror china

```

Expand Down
44 changes: 44 additions & 0 deletions sapi/quickstart/linux/alpine-init-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}

# use china mirror
# sh sapi/quickstart/linux/alpine-init-mini.sh --mirror [ china | ustc | tuna | tencentyun | huaweicloud ]


MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
MIRROR="$2"
;;
--*)
echo "no found mirror option $1"
;;
esac
shift $(($# > 0 ? 1 : 0))
done

case "$MIRROR" in
china | tuna | ustc)
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
test "$MIRROR" = "china" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "tuna" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "ustc" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
;;
tencentyun | huaweicloud) # 云服务的内网镜像源
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
test "$MIRROR" = "tencentyun" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tencentyun.com/g' /etc/apk/repositories
test "$MIRROR" = "huaweicloud" && sed -i 's/dl-cdn.alpinelinux.org/repo.huaweicloud.com/g' /etc/apk/repositories
;;

esac

apk update

apk add bash git curl wget xz zip unzip ca-certificates
94 changes: 94 additions & 0 deletions sapi/quickstart/linux/debian-init-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)

# use china mirror
# bash sapi/quickstart/linux/debian-init-mini.sh --mirror [ china | ustc | tuna | aliyuncs | tencentyun | huaweicloud ]

MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
case "$2" in
china | ustc | tuna | aliyuncs | tencentyun | huaweicloud )
MIRROR="$2"
;;
esac
;;
--*)
echo "Illegal option $1"
;;
esac
shift $(($# > 0 ? 1 : 0))
done



if test -n "$MIRROR" ; then
{
OS_ID=$(cat /etc/os-release | grep '^ID=' | awk -F '=' '{print $2}')
VERSION_ID=$(cat /etc/os-release | grep '^VERSION_ID=' | awk -F '=' '{print $2}' | sed "s/\"//g")
case $OS_ID in
debian)
case $VERSION_ID in
11 | 12 )
# debian 容器内和容器外 镜像源配置不一样
if [ -f /.dockerenv ] && [ "$VERSION_ID" = 12 ]; then
test -f /etc/apt/sources.list.d/debian.sources.save || cp -f /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.save
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list.d/debian.sources
# 云服务内网镜像源
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list.d/debian.sources
else
test -f /etc/apt/sources.list.save || cp /etc/apt/sources.list /etc/apt/sources.list.save
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list
fi
;;
*)
echo 'no match debian OS version' . $VERSION_ID
;;
esac
;;
ubuntu)
case $VERSION_ID in
20.04 | 22.04 | 22.10 | 23.04 | 23.10)
test -f /etc/apt/sources.list.save || cp /etc/apt/sources.list /etc/apt/sources.list.save
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list
;;
*)
echo 'no match ubuntu OS version' . $VERSION_ID
;;
esac
;;
*)
echo 'NO SUPPORT LINUX OS'
exit 0
;;
esac
}
fi

test -f /etc/apt/apt.conf.d/proxy.conf && rm -rf /etc/apt/apt.conf.d/proxy.conf

export DEBIAN_FRONTEND=noninteractive

apt update -y

apt install -y git curl wget ca-certificates xz-utils bzip2 p7zip lzip zip unzip
2 changes: 1 addition & 1 deletion sapi/quickstart/linux/debian-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ __DIR__=$(
)

# use china mirror
# bash sapi/quickstart/linux/debian-init.sh --mirror [china | ustc | tuna | aliyuncs | tencentyun | huaweicloud]
# bash sapi/quickstart/linux/debian-init.sh --mirror [ china | ustc | tuna | aliyuncs | tencentyun | huaweicloud ]

MIRROR=''
while [ $# -gt 0 ]; do
Expand Down
12 changes: 11 additions & 1 deletion sapi/quickstart/linux/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ mkdir -p ${__PROJECT__}/var

cd ${__PROJECT__}/var

curl -fsSL https://get.docker.com -o get-docker.sh
# https://github.com/docker/docker-install.git


# test -f get-docker.sh || curl -fsSL https://get.docker.com -o get-docker.sh
test -f get-docker.sh || curl -fsSL https://github.com/docker/docker-install/blob/master/install.sh?raw=true -o get-docker.sh

if [ -n "$http_proxy" ] || [ -n "$https_proxy" ] || [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then
echo 'Please delete proxy settings !'
echo 'Execute this script again !'
exit 0
fi

MIRROR=''
while [ $# -gt 0 ]; do
Expand Down
4 changes: 2 additions & 2 deletions sapi/quickstart/linux/run-alpine-container-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ case $ARCH in
fi
;;
'aarch64')
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240106T114724Z
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-shanghai.aliyuncs.com/jingjingxyk-public/app:${TAG}
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
fi
;;
*)
Expand Down
7 changes: 5 additions & 2 deletions sapi/src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ public function withMd5sum(string $md5sum): static
}

/**
* 配置 文件 签名验证
* https://www.php.net/manual/zh/function.hash-algos.php
* print_r(hash_algos());
* @param string $algo
* @param string $algo [ 'md5' | 'sha1' | 'sha256' ]
* @param string $hash
* @return $this
*/
Expand All @@ -115,8 +116,10 @@ public function withFileHash(string $algo, string $hash): static
return $this;
}

/*
/**
* hash 签名验证 ,hash 不匹配,删除文件
* @param string $file
* @return bool
*/
public function hashVerify(string $file): bool
{
Expand Down

0 comments on commit 21be0c8

Please sign in to comment.