Skip to content

Commit 36eef66

Browse files
authored
Merge pull request #929 from jingjingxyk/feature_v4.8.x
Feature v4.8.x
2 parents 3b3a18e + 839754f commit 36eef66

34 files changed

+692
-207
lines changed

.github/workflows/build-alpine-builder-container.sh

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -exu
44
__DIR__=$(
@@ -16,7 +16,7 @@ cd ${__PROJECT__}/var/build-github-action-container/
1616

1717
cp -f ${__PROJECT__}/sapi/quickstart/linux/alpine-init.sh .
1818

19-
cat > Dockerfile <<'EOF'
19+
cat >Dockerfile <<'EOF'
2020
FROM alpine:3.18
2121
2222
ENV TZ=Etc/UTC
@@ -25,7 +25,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2525
ADD ./alpine-init.sh /alpine-init.sh
2626
2727
RUN sh /alpine-init.sh
28-
# RUN sh /alpine-init.sh --mirror china
2928
3029
RUN uname -m
3130
RUN mkdir /work
@@ -35,9 +34,25 @@ ENTRYPOINT ["tini", "--"]
3534
3635
EOF
3736

38-
39-
40-
PLATFORM='linux/amd64'
37+
PLATFORM=''
38+
ARCH=$(uname -m)
39+
case $ARCH in
40+
'x86_64')
41+
PLATFORM='linux/amd64'
42+
;;
43+
'aarch64')
44+
PLATFORM='linux/arm64'
45+
;;
46+
'riscv64')
47+
PLATFORM="linux/riscv64"
48+
;;
49+
'mips64le')
50+
PLATFORM="linux/mips64le"
51+
;;
52+
'loongarch64')
53+
PLATFORM="linux/mips64le"
54+
;;
55+
esac
4156

4257
while [ $# -gt 0 ]; do
4358
case "$1" in
@@ -51,18 +66,14 @@ while [ $# -gt 0 ]; do
5166
shift $(($# > 0 ? 1 : 0))
5267
done
5368

54-
55-
5669
IMAGE='swoole-cli-builder:latest'
57-
docker buildx build -t ${IMAGE} -f ./Dockerfile . --platform ${PLATFORM}
70+
docker buildx build -t ${IMAGE} -f ./Dockerfile . --platform ${PLATFORM}
5871

5972
docker save -o "swoole-cli-builder-image.tar" ${IMAGE}
6073

61-
62-
6374
# alpine 可设置的架构选项
6475
# https://hub.docker.com/_/alpine/tags
65-
:<<'EOF'
76+
: <<'EOF'
6677
linux/386
6778
linux/amd64
6879
linux/arm/v6
@@ -72,4 +83,5 @@ linux/ppc64le
7283
linux/s390x
7384
EOF
7485

75-
86+
# 龙芯架构
87+
# https://cr.loongnix.cn/search
+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: build-swoole-cli-linux-aarch64-qemu
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
linux-aarch64-qemu:
7+
if: 0
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Show Environment Info
12+
run: |
13+
lscpu
14+
echo $PATH
15+
env
16+
docker info
17+
id -u
18+
id -g
19+
who
20+
cat /etc/os-release
21+
hostnamectl
22+
uname -s
23+
uname -m
24+
uname -r
25+
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
26+
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
27+
echo $IPV4
28+
echo $IPV6
29+
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
30+
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
31+
32+
- name: Prepare Build Environment
33+
run: |
34+
git submodule update --init
35+
36+
sudo mkdir -p /usr/local/swoole-cli
37+
uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli
38+
39+
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
40+
41+
- name: Prepare QEMU
42+
run: |
43+
set -x
44+
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
45+
46+
- name: Prepare swoole-cli-builder-image
47+
run: |
48+
if [ -f ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar ] ; then
49+
docker load -i ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
50+
else
51+
bash .github/workflows/build-alpine-builder-container.sh --platform "linux/arm64"
52+
fi
53+
54+
- name: prepare pre-built library
55+
uses: addnab/docker-run-action@v3
56+
with:
57+
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
58+
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/tmp/
59+
run: |
60+
for i in `ls /usr/local/swoole-cli/`
61+
do
62+
if [ ! -d /usr/local/tmp/${i} ] ; then
63+
echo $i
64+
cp -rf /usr/local/swoole-cli/${i}/ /usr/local/tmp/${i}
65+
fi
66+
done
67+
68+
- name: Build
69+
uses: addnab/docker-run-action@v3
70+
with:
71+
image: swoole-cli-builder:latest
72+
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli:/usr/local/swoole-cli
73+
run: |
74+
set -eux
75+
uname -m
76+
if [ ! -f bin/runtime/php ] ; then
77+
bash setup-php-runtime.sh
78+
fi
79+
80+
export PATH=/work/bin/runtime:$PATH # 容器已经内置 php 和 composer
81+
alias php="php -d curl.cainfo=/work/bin/runtime/cacert.pem -d openssl.cafile=/work/bin/runtime/cacert.pem"
82+
83+
sh sapi/quickstart/linux/alpine-init.sh
84+
composer install --no-interaction --no-autoloader --no-scripts --profile
85+
composer dump-autoload --optimize --profile
86+
87+
php prepare.php
88+
89+
bash make.sh all-library
90+
91+
bash make.sh config
92+
bash make.sh build
93+
bash make.sh archive
94+
95+
- name: Show Build Result
96+
uses: addnab/docker-run-action@v3
97+
with:
98+
image: swoole-cli-builder:latest
99+
options: -v ${{ github.workspace }}:/work -w /work
100+
run: |
101+
./bin/swoole-cli -v
102+
./bin/swoole-cli -m
103+
./bin/swoole-cli --ri gd
104+
./bin/swoole-cli --ri swoole
105+
file ./bin/swoole-cli
106+
readelf -h ./bin/swoole-cli
107+
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}')
108+
echo ${APP_VERSION}
109+
echo ${APP_VERSION} > APP_VERSION
110+
111+
./bin/swoole-cli -r "echo PHP_VERSION;"
112+
113+
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests
114+
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php

.github/workflows/linux-aarch64.yml

+38-69
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ on: [ push, pull_request ]
55
jobs:
66
linux-aarch64:
77
if: 1
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-24.04-arm
99
steps:
1010
- uses: actions/checkout@v4
1111
- name: Show Environment Info
1212
run: |
13-
lscpu
1413
echo $PATH
1514
env
1615
docker info
@@ -22,6 +21,13 @@ jobs:
2221
uname -s
2322
uname -m
2423
uname -r
24+
25+
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
26+
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
27+
cat /proc/cpuinfo | grep "cpu cores" | uniq
28+
cat /proc/cpuinfo| grep "processor"| wc -l
29+
lscpu
30+
2531
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
2632
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
2733
echo $IPV4
@@ -40,14 +46,14 @@ jobs:
4046
4147
- name: Cache PHP Runtime
4248
uses: actions/cache@v4
43-
id: php-runtime-cache
49+
id: php-runtime-cache-aarch64
4450
with:
4551
path: ${{ github.workspace }}/bin/runtime
4652
key: ${{ runner.os }}-aarch64-php-runtime
4753

4854
- name: Cache PHP Vendor
4955
uses: actions/cache@v4
50-
id: php-vendor-cache
56+
id: php-vendor-cache-aarch64
5157
with:
5258
path: ${{ github.workspace }}/vendor
5359
key: ${{ runner.os }}-aarch64-php-vendor
@@ -61,35 +67,18 @@ jobs:
6167

6268
- name: Cache all-library
6369
uses: actions/cache@v4
64-
id: all-library-cache
70+
id: all-library-cache-aarch64
6571
with:
6672
path: /usr/local/swoole-cli
6773
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-aarch64-all-library
6874

6975
- name: Cache swoole-cli-builder-image
7076
uses: actions/cache@v4
71-
id: swoole-cli-builder-image-aarch64-cache
77+
id: swoole-cli-builder-image-cache-aarch64
7278
with:
7379
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
7480
key: ${{ runner.os }}-aarch64-swoole-cli-builder-image
7581

76-
- name: Prepare Libraries and Extensions
77-
run: |
78-
set -x
79-
mkdir -p pool/lib
80-
mkdir -p pool/ext
81-
mkdir -p bin/runtime
82-
83-
bash sapi/download-box/download-box-get-archive-from-server.sh
84-
85-
ls -A pool/lib/
86-
ls -A /usr/local/swoole-cli/
87-
88-
- name: Prepare QEMU
89-
run: |
90-
set -x
91-
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
92-
9382
- name: Prepare swoole-cli-builder-image
9483
run: |
9584
if [ -f ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar ] ; then
@@ -98,19 +87,18 @@ jobs:
9887
bash .github/workflows/build-alpine-builder-container.sh --platform "linux/arm64"
9988
fi
10089
101-
- name: prepare pre-built library
102-
uses: addnab/docker-run-action@v3
103-
with:
104-
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php7-v1.0.0-aarch64-20240106T123157Z
105-
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/tmp/
106-
run: |
107-
for i in `ls /usr/local/swoole-cli/`
108-
do
109-
if [ ! -d /usr/local/tmp/${i} ] ; then
110-
echo $i
111-
cp -rf /usr/local/swoole-cli/${i}/ /usr/local/tmp/${i}
112-
fi
113-
done
90+
- name: Prepare Runtime and Libraries and Extensions
91+
run: |
92+
set -x
93+
mkdir -p pool/lib
94+
mkdir -p pool/ext
95+
mkdir -p bin/runtime
96+
if [ ! -f bin/runtime/php ] ; then
97+
bash setup-php-runtime.sh
98+
fi
99+
bash sapi/download-box/download-box-get-archive-from-server.sh
100+
ls -A pool/lib/
101+
ls -A /usr/local/swoole-cli/
114102
115103
- name: Build
116104
uses: addnab/docker-run-action@v3
@@ -120,10 +108,6 @@ jobs:
120108
run: |
121109
set -eux
122110
uname -m
123-
if [ ! -f bin/runtime/php ] ; then
124-
bash setup-php-runtime.sh
125-
fi
126-
127111
export PATH=/work/bin/runtime:$PATH # 容器已经内置 php 和 composer
128112
alias php="php -d curl.cainfo=/work/bin/runtime/cacert.pem -d openssl.cafile=/work/bin/runtime/cacert.pem"
129113
@@ -139,41 +123,26 @@ jobs:
139123
140124
bash make-install-deps.sh
141125
142-
bash make.sh all-library
126+
bash ./make.sh all-library
143127
144-
bash make.sh config
145-
bash make.sh build
146-
bash make.sh archive
128+
bash ./make.sh config
129+
bash ./make.sh build
130+
bash ./make.sh archive
147131
148132
- name: Show Build Result
149-
uses: addnab/docker-run-action@v3
150-
with:
151-
image: swoole-cli-builder:latest
152-
options: -v ${{ github.workspace }}:/work -w /work
153-
run: |
154-
./bin/swoole-cli -v
155-
./bin/swoole-cli -m
156-
./bin/swoole-cli --ri gd
157-
./bin/swoole-cli --ri swoole
158-
./bin/swoole-cli --ri gd
159-
./bin/swoole-cli --ri pgsql
160-
161-
file ./bin/swoole-cli
162-
readelf -h ./bin/swoole-cli
163-
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}')
164-
echo ${APP_VERSION}
165-
echo ${APP_VERSION} > APP_VERSION
166-
167-
./bin/swoole-cli -r "echo PHP_VERSION;"
168-
169-
# ./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests
170-
# ./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php
171133

172-
- name: get app version
173134
run: |
174-
APP_VERSION=$(cat ./APP_VERSION)
175-
echo $APP_VERSION
135+
./bin/swoole-cli -v
136+
./bin/swoole-cli -m
137+
./bin/swoole-cli --ri gd
138+
./bin/swoole-cli --ri swoole
139+
file ./bin/swoole-cli
140+
readelf -h ./bin/swoole-cli
141+
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}')
176142
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
143+
./bin/swoole-cli -r "echo PHP_VERSION;"
144+
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests
145+
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php
177146
178147
- name: production artifacts debug
179148
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)