Skip to content

Commit ae9c8f0

Browse files
authored
更新 默认php 运行时所在目录 (swoole#976)
* 更新 默认设置php 运行时所在目录 * 更新使用swoole-cli 运行时 * update auto-cache-pool-tarball.yml * update * update setup-swoole-cli-runtime.sh * 解决构建时 php 运行时目录错误 * update run-swoole-cli-builder-container.sh * 使用内存作为 缓存目录,加快构建 * update * update setup-php-runtime.sh * update setup-php-runtime.sh * update setup-php-runtime.sh * update setup-php-runtime.sh * update setup-swoole-cli-runtime.sh * 移除无效的代码
1 parent 75f08ed commit ae9c8f0

16 files changed

+110
-202
lines changed

.github/workflows/auto-cache-pool-tarball.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ jobs:
7272
mkdir -p pool/lib
7373
mkdir -p pool/ext
7474
mkdir -p runtime/
75-
if [ ! -f runtime/php ] ; then
75+
test -f runtime/php && rm -f runtime/php
76+
if [ ! -f runtime/php/php ] ; then
7677
bash setup-php-runtime.sh
7778
fi
7879
7980
WORK_DIR=${{ github.workspace }}
80-
export PATH=${WORK_DIR}/runtime/:$PATH
81-
alias php="php -d curl.cainfo=${WORK_DIR}/runtime/cacert.pem -d openssl.cafile=${WORK_DIR}/runtime/cacert.pem"
81+
export PATH=${WORK_DIR}/runtime/php/:$PATH
82+
alias php="php -d curl.cainfo=${WORK_DIR}/runtime/php/cacert.pem -d openssl.cafile=${WORK_DIR}/runtime/php/cacert.pem"
8283
8384
composer install --no-interaction --no-autoloader --no-scripts --profile
8485
composer dump-autoload --optimize --profile

.github/workflows/linux-aarch64-qemu.yml

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

.github/workflows/linux-aarch64.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ jobs:
9494
mkdir -p pool/ext
9595
mkdir -p bin/
9696
mkdir -p runtime/
97-
if [ ! -f runtime/php ] ; then
97+
test -f runtime/php && rm -f runtime/php
98+
if [ ! -f runtime/php/php ] ; then
9899
bash setup-php-runtime.sh
99100
fi
100101
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -109,20 +110,20 @@ jobs:
109110
run: |
110111
set -eux
111112
uname -m
112-
export PATH=/work/runtime:$PATH # 容器已经内置 php 和 composer
113-
alias php="php -d curl.cainfo=/work/runtime/cacert.pem -d openssl.cafile=/work/runtime/cacert.pem"
113+
export PATH=/work/runtime/php/:$PATH # 容器已经内置 php 和 composer
114+
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
114115
115116
sh sapi/quickstart/linux/alpine-init.sh
116117
composer install --no-interaction --no-autoloader --no-scripts --profile
117118
composer dump-autoload --optimize --profile
118119
119120
php prepare.php
120121
121-
bash ./make.sh all-library
122+
bash make.sh all-library
122123
123-
bash ./make.sh config
124-
bash ./make.sh build
125-
bash ./make.sh archive
124+
bash make.sh config
125+
bash make.sh build
126+
bash make.sh archive
126127
127128
- name: Show Build Result
128129
run: |

.github/workflows/linux-x86_64.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ jobs:
9494
mkdir -p pool/ext
9595
mkdir -p bin/
9696
mkdir -p runtime/
97-
if [ ! -f runtime/php ] ; then
97+
test -f runtime/php && rm -f runtime/php
98+
if [ ! -f runtime/php/php ] ; then
9899
bash setup-php-runtime.sh
99100
fi
100101
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -109,20 +110,20 @@ jobs:
109110
run: |
110111
set -eux
111112
uname -m
112-
export PATH=/work/runtime:$PATH # 容器已经内置 php 和 composer
113-
alias php="php -d curl.cainfo=/work/runtime/cacert.pem -d openssl.cafile=/work/runtime/cacert.pem"
113+
export PATH=/work/runtime/php:$PATH # 容器已经内置 php 和 composer
114+
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
114115
115116
sh sapi/quickstart/linux/alpine-init.sh
116117
composer install --no-interaction --no-autoloader --no-scripts --profile
117118
composer dump-autoload --optimize --profile
118119
119120
php prepare.php
120121
121-
bash ./make.sh all-library
122+
bash make.sh all-library
122123
123-
bash ./make.sh config
124-
bash ./make.sh build
125-
bash ./make.sh archive
124+
bash make.sh config
125+
bash make.sh build
126+
bash make.sh archive
126127
127128
- name: Start Database
128129
run: |

.github/workflows/macos-aarch64.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ jobs:
8989
mkdir -p pool/ext
9090
mkdir -p bin/
9191
mkdir -p runtime/
92-
if [ ! -f runtime/php ] ; then
92+
test -f runtime/php && rm -f runtime/php
93+
if [ ! -f runtime/php/php ] ; then
9394
bash setup-php-runtime.sh
9495
fi
9596
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -98,8 +99,8 @@ jobs:
9899
99100
- name: prepare
100101
run: |
101-
export PATH=${{ github.workspace }}/runtime:$PATH
102-
alias php="php -d curl.cainfo=${{ github.workspace }}/runtime/cacert.pem -d openssl.cafile=${{ github.workspace }}/runtime/cacert.pem"
102+
export PATH=${{ github.workspace }}/runtime/php/:$PATH
103+
alias php="php -d curl.cainfo=${{ github.workspace }}/runtime/php/cacert.pem -d openssl.cafile=${{ github.workspace }}/runtime/php/cacert.pem"
103104
104105
composer install --no-interaction --no-autoloader --no-scripts --profile
105106
composer dump-autoload --optimize --profile
@@ -108,13 +109,13 @@ jobs:
108109
109110
- name: Build
110111
run: |
111-
export PATH=${{ github.workspace }}/runtime:$PATH
112+
export PATH=${{ github.workspace }}/runtime/php/:$PATH
112113
113-
bash ./make.sh all-library
114+
bash make.sh all-library
114115
115-
bash ./make.sh config
116-
bash ./make.sh build
117-
bash ./make.sh archive
116+
bash make.sh config
117+
bash make.sh build
118+
bash make.sh archive
118119
119120
- name: Show Build Result
120121
run: |

.github/workflows/macos-x86_64.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ jobs:
8989
mkdir -p pool/ext
9090
mkdir -p bin/
9191
mkdir -p runtime/
92-
if [ ! -f runtime/php ] ; then
92+
test -f runtime/php && rm -f runtime/php
93+
if [ ! -f runtime/php/php ] ; then
9394
bash setup-php-runtime.sh
9495
fi
9596
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -98,8 +99,8 @@ jobs:
9899
99100
- name: prepare
100101
run: |
101-
export PATH=${{ github.workspace }}/runtime:$PATH
102-
alias php="php -d curl.cainfo=${{ github.workspace }}/runtime/cacert.pem -d openssl.cafile=${{ github.workspace }}/runtime/cacert.pem"
102+
export PATH=${{ github.workspace }}/runtime/php/:$PATH
103+
alias php="php -d curl.cainfo=${{ github.workspace }}/runtime/php/cacert.pem -d openssl.cafile=${{ github.workspace }}/runtime/php/cacert.pem"
103104
104105
composer install --no-interaction --no-autoloader --no-scripts --profile
105106
composer dump-autoload --optimize --profile
@@ -108,7 +109,7 @@ jobs:
108109
109110
- name: Build
110111
run: |
111-
export PATH=${{ github.workspace }}/runtime:$PATH
112+
export PATH=${{ github.workspace }}/runtime/php/:$PATH
112113
113114
bash ./make.sh all-library
114115

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545

4646
curl -fSL https://github.com/swoole/swoole-cli/blob/main/setup-swoole-cli-runtime.sh?raw=true | bash
4747

48+
# windows powershell
49+
irm https://github.com/swoole/swoole-cli/blob/main/setup-swoole-cli-runtime.ps1?raw=true | iex
50+
4851
# 来自 https://www.swoole.com/download
4952
curl -fSL https://github.com/swoole/swoole-cli/blob/main/setup-swoole-cli-runtime.sh?raw=true | bash -s -- --mirror china
5053

@@ -88,9 +91,8 @@ bash setup-php-runtime.sh --mirror china
8891
# shell脚本中启用别名扩展功能‌
8992
shopt -s expand_aliases
9093
__DIR__=$(pwd)
91-
export PATH="${__DIR__}/runtime:$PATH"
92-
ln -sf ${__DIR__}/runtime/swoole-cli ${__DIR__}/runtime/php
93-
alias php="php -d curl.cainfo=${__DIR__}/runtime/cacert.pem -d openssl.cafile=${__DIR__}/runtime/cacert.pem"
94+
export PATH="${__DIR__}/runtime/php/:$PATH"
95+
alias php="php -d curl.cainfo=${__DIR__}/runtime/php/cacert.pem -d openssl.cafile=${__DIR__}/runtime/php/cacert.pem"
9496
which php
9597
php -v
9698

build-release-example.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ if [ "$OS" = 'macos' ]; then
137137

138138
fi
139139

140-
if [ ! -f "${__PROJECT__}/runtime/php" ]; then
140+
if [ ! -f "${__PROJECT__}/runtime/php/php" ]; then
141141
if [ "$MIRROR" = 'china' ]; then
142142
bash ${__PROJECT__}/setup-php-runtime.sh --mirror china
143143
else
144144
bash ${__PROJECT__}/setup-php-runtime.sh
145145
fi
146146
fi
147147

148-
export PATH="${__PROJECT__}/runtime:$PATH"
149-
alias php="php -d curl.cainfo=${__PROJECT__}/runtime/cacert.pem -d openssl.cafile=${__PROJECT__}/runtime/cacert.pem"
148+
export PATH="${__PROJECT__}/runtime/php/:$PATH"
149+
alias php="php -d curl.cainfo=${__PROJECT__}/runtime/php/cacert.pem -d openssl.cafile=${__PROJECT__}/runtime/php/cacert.pem"
150150

151151
php -v
152152

@@ -170,6 +170,7 @@ fi
170170

171171
# 可用配置参数
172172
# --with-swoole-pgsql=1
173+
# --with-libavif=1
173174
# --with-global-prefix=/usr/local/swoole-cli
174175
# --with-dependency-graph=1
175176
# --with-web-ui

sapi/docker/build-export-container.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ while [ $# -gt 0 ]; do
4949
shift $(($# > 0 ? 1 : 0))
5050
done
5151

52-
case "$MIRROR" in
53-
china | openatom)
54-
CONTAINER_BASE_IMAGE="docker.io/library/alpine:3.18"
55-
;;
56-
esac
57-
5852
mkdir -p var/build-export-container/
5953
cd ${__PROJECT__}/var/build-export-container/
6054

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -exu
4+
__DIR__=$(
5+
cd "$(dirname "$0")"
6+
pwd
7+
)
8+
__PROJECT__=$(
9+
cd ${__DIR__}/../../../
10+
pwd
11+
)
12+
cd ${__DIR__}
13+
14+
{
15+
docker stop swoole-cli-alpine-dev
16+
sleep 5
17+
} || {
18+
echo $?
19+
}
20+
cd ${__DIR__}
21+
22+
IMAGE=alpine:3.18
23+
24+
cd ${__DIR__}
25+
26+
mkdir -p /dev/shm/swoole-cli/thirdparty/
27+
mkdir -p /dev/shm/swoole-cli/ext/
28+
mkdir -p /dev/shm/swoole-cli/var/
29+
30+
docker run --rm --name swoole-cli-alpine-dev -d \
31+
-v ${__PROJECT__}:/work \
32+
-v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ \
33+
-v /dev/shm/swoole-cli/ext/:/work/ext/ \
34+
-v /dev/shm/swoole-cli/var/:/work/var/ \
35+
-w /work --init $IMAGE tail -f /dev/null

0 commit comments

Comments
 (0)