Skip to content

Commit 07cc21c

Browse files
authored
Merge pull request #1064 from jingjingxyk/experiment-feature
Experiment feature
2 parents a774a3b + c76cf4f commit 07cc21c

38 files changed

Lines changed: 1174 additions & 159 deletions

.github/workflows/linux-aarch64.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
mkdir -p bin/
9696
mkdir -p runtime/
9797
test -f runtime/php && rm -f runtime/php
98-
if [ ! -f runtime/php/php ] ; then
98+
if [ ! -f runtime/php/pie ] ; then
9999
bash setup-php-runtime.sh
100100
fi
101101
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -114,6 +114,8 @@ jobs:
114114
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
115115
116116
sh sapi/quickstart/linux/alpine-init.sh
117+
git config --global --add safe.directory /work
118+
117119
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
118120
composer dump-autoload --optimize --profile --no-dev
119121

.github/workflows/linux-glibc.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: build-swoole-cli-linux-glibc-x86_64
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
linux-glibc:
7+
if: ${{ !contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[linux-glibc]') }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ ubuntu-22.04, ubuntu-22.04-arm ]
12+
name: linux-glibc-${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Show Environment Info
17+
run: |
18+
echo $PATH
19+
env
20+
docker info
21+
id -u
22+
id -g
23+
who
24+
cat /etc/os-release
25+
hostnamectl
26+
uname -s
27+
uname -m
28+
uname -r
29+
30+
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
31+
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
32+
cat /proc/cpuinfo | grep "cpu cores" | uniq
33+
cat /proc/cpuinfo| grep "processor"| wc -l
34+
lscpu
35+
36+
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
37+
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
38+
echo $IPV4
39+
echo $IPV6
40+
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
41+
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
42+
43+
- name: Prepare Build Environment
44+
run: |
45+
git submodule update --init
46+
47+
sudo mkdir -p /usr/local/swoole-cli
48+
uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli
49+
50+
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
51+
52+
- name: Cache PHP Runtime
53+
uses: actions/cache@v4
54+
id: php-runtime-cache-x86_64
55+
with:
56+
path: ${{ github.workspace }}/runtime
57+
key: ${{ runner.os }}-x86_64-php-runtime
58+
59+
- name: Cache PHP Vendor
60+
uses: actions/cache@v4
61+
id: php-vendor-cache-x86_64
62+
with:
63+
path: ${{ github.workspace }}/vendor
64+
key: ${{ runner.os }}-x86_64-php-vendor
65+
66+
- name: Cache Dependency Source Code Tarball
67+
uses: actions/cache@v4
68+
id: pool-cache
69+
with:
70+
path: ${{ github.workspace }}/pool/
71+
key: source-code-tarball-pool
72+
73+
- name: Cache all-library
74+
uses: actions/cache@v4
75+
id: all-library-cache-x86_64
76+
with:
77+
path: /usr/local/swoole-cli
78+
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library
79+
80+
- name: Prepare Runtime and Libraries and Extensions
81+
run: |
82+
set -x
83+
mkdir -p pool/lib
84+
mkdir -p pool/ext
85+
mkdir -p bin/
86+
mkdir -p runtime/
87+
test -f runtime/php && rm -f runtime/php
88+
if [ ! -f runtime/php/pie ] ; then
89+
bash setup-php-runtime.sh
90+
fi
91+
bash sapi/download-box/download-box-get-archive-from-server.sh
92+
ls -A pool/lib/
93+
ls -A /usr/local/swoole-cli/
94+
95+
- name: Build
96+
run: |
97+
set -eux
98+
uname -m
99+
composer install --no-interaction --no-autoloader --no-scripts --profile
100+
composer dump-autoload --optimize --profile
101+
102+
php prepare.php --with-libavif --without-docker
103+
104+
sudo apt update
105+
bash ./sapi/scripts/install-deps-on-ubuntu.sh
106+
bash ./ext/swoole/scripts/install-deps-on-ubuntu.sh
107+
bash ./sapi/scripts/build-swoole-cli-with-linux-gcc.sh
108+
109+
./bin/swoole-cli -v
110+
./bin/swoole-cli -m
111+
./bin/swoole-cli --ri curl
112+
./bin/swoole-cli --ri gd
113+
./bin/swoole-cli --ri imagick
114+
./bin/swoole-cli --ri swoole
115+
{ ldd ./bin/swoole-cli ; } || { echo $? ; } ;
116+
file ./bin/swoole-cli
117+
118+
- name: Make nfpm package
119+
run: |
120+
ARCH=$(uname -m)
121+
if [ "$ARCH" = "aarch64" ]; then
122+
NFPM_ARCH="arm64"
123+
else
124+
NFPM_ARCH="amd64"
125+
fi
126+
wget https://github.com/goreleaser/nfpm/releases/download/v2.43.4/nfpm_2.43.4_${NFPM_ARCH}.deb
127+
sudo dpkg -i nfpm_2.43.4_${NFPM_ARCH}.deb
128+
strip ./bin/swoole-cli
129+
./make.sh nfpm-pkg
130+
ls -ls ./*.deb
131+
ls -ls ./*.rpm
132+
133+
- name: upload artifacts to cloud object storage
134+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
135+
env:
136+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
137+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
138+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
139+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
140+
run: |
141+
ARCH=$(uname -m)
142+
if [ "$ARCH" = "aarch64" ]; then
143+
FILE_ARCH="arm64"
144+
else
145+
FILE_ARCH="x64"
146+
fi
147+
SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "sapi/SWOOLE-VERSION.conf")
148+
OS="linux"
149+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.deb
150+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.rpm

.github/workflows/linux-x86_64.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
mkdir -p bin/
115115
mkdir -p runtime/
116116
test -f runtime/php && rm -f runtime/php
117-
if [ ! -f runtime/php/php ] ; then
117+
if [ ! -f runtime/php/pie ] ; then
118118
bash setup-php-runtime.sh
119119
fi
120120
@@ -139,6 +139,8 @@ jobs:
139139
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
140140
141141
sh sapi/quickstart/linux/alpine-init.sh
142+
git config --global --add safe.directory /work
143+
142144
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
143145
composer dump-autoload --optimize --profile --no-dev
144146

.github/workflows/macos-aarch64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
mkdir -p bin/
9191
mkdir -p runtime/
9292
test -f runtime/php && rm -f runtime/php
93-
if [ ! -f runtime/php/php ] ; then
93+
if [ ! -f runtime/php/pie ] ; then
9494
bash setup-php-runtime.sh
9595
fi
9696
bash sapi/download-box/download-box-get-archive-from-server.sh

.github/workflows/macos-x86_64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
mkdir -p bin/
9292
mkdir -p runtime/
9393
test -f runtime/php && rm -f runtime/php
94-
if [ ! -f runtime/php/php ] ; then
94+
if [ ! -f runtime/php/pie ] ; then
9595
bash setup-php-runtime.sh
9696
fi
9797
bash sapi/download-box/download-box-get-archive-from-server.sh

.github/workflows/windows-msys2.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
windows-msys2:
9-
if: 0
9+
if: 1
1010
runs-on: windows-2022
1111
steps:
1212
- name: Show Environment Info
@@ -31,15 +31,6 @@ jobs:
3131
git config --global --add safe.directory ${{ github.workspace }}
3232
3333
- uses: actions/checkout@v4
34-
- name: Cache msys2 packages
35-
id: cache-msys2
36-
uses: actions/cache@v4
37-
env:
38-
cache-name: cache-msys2-packages
39-
with:
40-
path: C:\msys2-packages
41-
key: "${{ runner.os }}-build-${{ env.cache-name }}"
42-
4334
- name: Cache pool
4435
id: cache-msys2-pool
4536
uses: actions/cache@v4
@@ -56,7 +47,8 @@ jobs:
5647
- name: prepare build environment
5748
shell: msys2 {0}
5849
run: |
59-
bash ./sapi/quickstart/windows/msys2-build/install-msys2.sh
50+
bash sapi/quickstart/windows/msys2-build/install-msys2.sh
51+
bash sapi/download-box/download-box-get-archive-from-server.sh
6052
6153
- name: install deps lib with source code
6254
shell: msys2 {0}
@@ -117,3 +109,26 @@ jobs:
117109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118110
with:
119111
files: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-msys2-x64.zip
112+
113+
114+
upload-to-cloud-object-storage:
115+
if: 1
116+
runs-on: ubuntu-latest
117+
needs: windows-msys2
118+
steps:
119+
- name: Prepare Run Environment
120+
run:
121+
sudo apt install -y curl
122+
- uses: actions/checkout@v4
123+
- uses: actions/download-artifact@v4
124+
- name: upload artifacts to cloud object storage
125+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
126+
env:
127+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
128+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
129+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
130+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
131+
run: |
132+
FILE_NAME=$(ls -d swoole-cli-v*-msys2-x64)
133+
FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip"
134+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${FILE}

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ tmp-php.ini
315315
/ext/ds
316316
/ext/xlswriter
317317
/ext/uuid
318+
/ext/phpy
318319
/.phpunit.result.cache
319320
/samples/sfx/*.phar
320321
.php-cs-fixer.cache
@@ -334,8 +335,6 @@ php.ini
334335
sapi/webUI/deploy.sh
335336
sapi/webUI/public/data/
336337
Makefile.backup
337-
ldflags.log
338-
cppflags.log
339338
libs.log
340339
ext/apcu/
341340
ext/ssh2/
@@ -348,3 +347,7 @@ php-fpm-*
348347
!/runtime/.gitkeep
349348
/APP_NAME
350349
/APP_VERSION
350+
*.deb
351+
*.rpm
352+
nfpm-pkg.yaml
353+
!/var/.gitkeep

bin/.gitkeep

Whitespace-only changes.

prepare.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,23 @@
3535
// Sync code from php-src
3636
$p->setPhpSrcDir($p->getWorkDir() . '/var/php-' . BUILD_PHP_VERSION);
3737

38+
/*
39+
// Download swoole-src
40+
if (!is_dir(__DIR__ . '/ext/swoole')) {
41+
//shell_exec(__DIR__ . '/sapi/scripts/download-swoole-src-archive.sh');
42+
}
43+
*/
44+
3845
// Compile directly on the host machine, not in the docker container
39-
if ($p->getInputOption('without-docker') || ($p->isMacos())) {
46+
if ($p->getInputOption('without-docker') || ($p->isMacos()) || ($p->isLinux() && (!is_file('/.dockerenv')))) {
4047
$p->setWorkDir(__DIR__);
4148
$p->setBuildDir(__DIR__ . '/thirdparty');
4249
}
4350

44-
4551
if ($p->getInputOption('with-override-default-enabled-ext')) {
4652
$p->setExtEnabled([]);
4753
}
4854

49-
5055
if ($p->getInputOption('with-global-prefix')) {
5156
$p->setGlobalPrefix($p->getInputOption('with-global-prefix'));
5257
}
@@ -93,7 +98,12 @@
9398
if ($p->isMacos()) {
9499
//$p->setExtraLdflags('-undefined dynamic_lookup');
95100
$p->setExtraLdflags('');
96-
$homebrew_prefix = trim(shell_exec('brew --prefix'));
101+
exec("brew --prefix 2>&1", $output, $result_code);
102+
if ($result_code == 0) {
103+
$homebrew_prefix = trim(implode(' ', $output));
104+
} else {
105+
$homebrew_prefix = "";
106+
}
97107
$p->withBinPath($homebrew_prefix . '/opt/flex/bin')
98108
->withBinPath($homebrew_prefix . '/opt/bison/bin')
99109
->withBinPath($homebrew_prefix . '/opt/libtool/bin')

sapi/SWOOLE-VERSION.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v6.1.1
1+
v6.1.6

0 commit comments

Comments
 (0)