Skip to content

Commit 8b0156d

Browse files
authored
Merge pull request #1083 from jingjingxyk/build_native_php
Build native php
2 parents 7278d53 + 4834585 commit 8b0156d

46 files changed

Lines changed: 995 additions & 357 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/artifact-hash.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
generate-artifact-hash:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
2626
- name: Show Release File Hash
2727
run: |
2828
bash sapi/scripts/generate-artifact-hash.sh --version ${{ inputs.version }} --with-php-versions ${{ inputs.php-version }}
2929
3030
- name: production artifacts
31-
uses: actions/upload-artifact@v4
31+
uses: actions/upload-artifact@v5
3232
with:
3333
name: ${{ inputs.version }}-sha256sum
3434
retention-days: 90

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: ${{ (github.repository_owner == 'swoole') || (github.repository_owner == 'jingjingxyk') }}
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- name: Prepare Source Code
1717
run: |
1818
echo $PATH
@@ -41,21 +41,21 @@ jobs:
4141
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
4242
4343
- name: Cache PHP Runtime
44-
uses: actions/cache@v4
44+
uses: actions/cache@v5
4545
id: php-runtime-cache
4646
with:
4747
path: ${{ github.workspace }}/runtime
4848
key: ${{ runner.os }}-x86_64-php-runtime
4949

5050
- name: Cache PHP Vendor
51-
uses: actions/cache@v4
51+
uses: actions/cache@v5
5252
id: php-vendor-cache
5353
with:
5454
path: ${{ github.workspace }}/vendor
5555
key: ${{ runner.os }}-x86_64-php-vendor
5656

5757
- name: Cache Dependency Source Code Tarball
58-
uses: actions/cache@v4
58+
uses: actions/cache@v5
5959
id: pool-cache
6060
with:
6161
path: ${{ github.workspace }}/pool/
@@ -74,7 +74,7 @@ jobs:
7474
mkdir -p pool/php-tar/
7575
mkdir -p runtime/
7676
test -f runtime/php && rm -f runtime/php
77-
if [ ! -f runtime/php/php ] ; then
77+
if [ ! -f runtime/php/box ] ; then
7878
bash setup-php-runtime.sh
7979
fi
8080
@@ -109,7 +109,7 @@ jobs:
109109
cat bin/LICENSE
110110
111111
- name: production artifacts
112-
uses: actions/upload-artifact@v4
112+
uses: actions/upload-artifact@v5
113113
with:
114114
name: all-deps
115115
retention-days: 90

.github/workflows/linux-aarch64.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: build-php-cli-linux-aarch64
33
on: [ push, pull_request ]
44

55
env:
6-
BUILD_PHP_VERSION: 8.2.28
6+
BUILD_PHP_VERSION: 8.4.21
77

88
jobs:
99
linux-aarch64:
@@ -12,13 +12,13 @@ jobs:
1212
strategy:
1313
matrix:
1414
php-version:
15-
- "8.2.30"
15+
- "8.2.31"
1616
- "8.1.34"
17-
- "8.3.29"
18-
- "8.4.16"
19-
# - "8.5.0"
17+
- "8.3.31"
18+
- "8.4.21"
19+
- "8.5.6"
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
- name: Show Environment Info
2323
run: |
2424
echo $PATH
@@ -57,35 +57,35 @@ jobs:
5757
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
5858
5959
- name: Cache PHP Runtime
60-
uses: actions/cache@v4
60+
uses: actions/cache@v5
6161
id: php-runtime-cache-aarch64
6262
with:
6363
path: ${{ github.workspace }}/runtime
6464
key: ${{ runner.os }}-aarch64-php-runtime
6565

6666
- name: Cache PHP Vendor
67-
uses: actions/cache@v4
67+
uses: actions/cache@v5
6868
id: php-vendor-cache-aarch64
6969
with:
7070
path: ${{ github.workspace }}/vendor
7171
key: ${{ runner.os }}-aarch64-php-vendor
7272

7373
- name: Cache Dependency Source Code Tarball
74-
uses: actions/cache@v4
74+
uses: actions/cache@v5
7575
id: pool-cache
7676
with:
7777
path: ${{ github.workspace }}/pool/
7878
key: source-code-tarball-pool
7979

8080
- name: Cache all-library
81-
uses: actions/cache@v4
81+
uses: actions/cache@v5
8282
id: all-library-cache-aarch64
8383
with:
8484
path: /usr/local/swoole-cli
8585
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-aarch64-all-library
8686

8787
- name: Cache swoole-cli-builder-image
88-
uses: actions/cache@v4
88+
uses: actions/cache@v5
8989
id: swoole-cli-builder-image-cache-aarch64
9090
with:
9191
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
@@ -107,7 +107,7 @@ jobs:
107107
mkdir -p bin/
108108
mkdir -p runtime/
109109
test -f runtime/php && rm -f runtime/php
110-
if [ ! -f runtime/php/php ] ; then
110+
if [ ! -f runtime/php/box ] ; then
111111
bash setup-php-runtime.sh
112112
fi
113113
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -131,7 +131,7 @@ jobs:
131131
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
132132
composer dump-autoload --optimize --profile --no-dev
133133
134-
php prepare.php --with-static-pie --with-libavif +inotify +apcu +ds +xlswriter +ssh2 +pgsql +uuid --with-php-version=${{ env.BUILD_PHP_VERSION }}
134+
php prepare.php --with-static-pie --with-libavif +inotify +apcu +ds +pgsql +uuid --with-php-version=${{ env.BUILD_PHP_VERSION }}
135135
136136
bash make-install-deps.sh
137137
@@ -172,14 +172,14 @@ jobs:
172172
echo "APP_NAME=${APP_NAME}" >> $GITHUB_ENV
173173
174174
- name: production artifacts debug
175-
uses: actions/upload-artifact@v4
175+
uses: actions/upload-artifact@v5
176176
with:
177177
name: ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-linux-arm64-debug
178178
retention-days: 90
179179
path: ./bin/php-${{ env.APP_VERSION }}/bin/php
180180

181181
- name: production artifacts
182-
uses: actions/upload-artifact@v4
182+
uses: actions/upload-artifact@v5
183183
with:
184184
name: ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-linux-arm64
185185
retention-days: 90

.github/workflows/linux-glibc.yml

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build-swoole-cli-linux-glibc-x86_64
1+
name: build-swoole-cli-linux-glibc
22

33
on: [ push, pull_request ]
44

@@ -12,7 +12,7 @@ jobs:
1212
name: linux-glibc-${{ matrix.os }}
1313
runs-on: ${{ matrix.os }}
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- name: Show Environment Info
1717
run: |
1818
echo $PATH
@@ -49,34 +49,13 @@ jobs:
4949
5050
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
5151
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-
6652
- name: Cache Dependency Source Code Tarball
67-
uses: actions/cache@v4
53+
uses: actions/cache@v5
6854
id: pool-cache
6955
with:
7056
path: ${{ github.workspace }}/pool/
7157
key: source-code-tarball-pool
7258

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-
8059
- name: Prepare Runtime and Libraries and Extensions
8160
run: |
8261
set -x
@@ -85,7 +64,7 @@ jobs:
8564
mkdir -p bin/
8665
mkdir -p runtime/
8766
test -f runtime/php && rm -f runtime/php
88-
if [ ! -f runtime/php/php ] ; then
67+
if [ ! -f runtime/php/box ] ; then
8968
bash setup-php-runtime.sh
9069
fi
9170
bash sapi/download-box/download-box-get-archive-from-server.sh
@@ -99,11 +78,11 @@ jobs:
9978
composer install --no-interaction --no-autoloader --no-scripts --profile
10079
composer dump-autoload --optimize --profile
10180
102-
php prepare.php --with-libavif
81+
php prepare.php --with-libavif --without-docker --with-iouring
10382
10483
sudo apt update
105-
bash ./sapi/scripts/install-deps-on-ubuntu.sh
106-
bash ./ext/swoole/scripts/install-deps-on-ubuntu.sh
84+
sudo bash ./sapi/scripts/install-deps-on-ubuntu.sh
85+
sudo bash ./ext/swoole/scripts/install-deps-on-ubuntu.sh
10786
bash ./sapi/scripts/build-swoole-cli-with-linux-gcc.sh
10887
10988
./bin/swoole-cli -v
@@ -114,6 +93,8 @@ jobs:
11493
./bin/swoole-cli --ri swoole
11594
{ ldd ./bin/swoole-cli ; } || { echo $? ; } ;
11695
file ./bin/swoole-cli
96+
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}')
97+
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
11798
11899
- name: Make nfpm package
119100
run: |
@@ -130,6 +111,38 @@ jobs:
130111
ls -ls ./*.deb
131112
ls -ls ./*.rpm
132113
114+
ARCH=$(uname -m)
115+
if [ "$ARCH" = "aarch64" ]; then
116+
FILE_ARCH="arm64"
117+
else
118+
FILE_ARCH="x64"
119+
fi
120+
OS="linux"
121+
echo "FILE_ARCH=${FILE_ARCH}" >> $GITHUB_ENV
122+
echo "OS=${OS}" >> $GITHUB_ENV
123+
124+
- name: production artifacts debian
125+
uses: actions/upload-artifact@v5
126+
with:
127+
name: swoole-cli-glibc-for-debian-${{ env.FILE_ARCH }}
128+
retention-days: 90
129+
path: ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.deb
130+
131+
- name: production artifacts redhat
132+
uses: actions/upload-artifact@v5
133+
with:
134+
name: swoole-cli-glibc-for-redhat-${{ env.FILE_ARCH }}
135+
retention-days: 90
136+
path: ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.rpm
137+
138+
- name: gh release
139+
uses: softprops/action-gh-release@v2
140+
if: startsWith(github.ref, 'refs/tags/')
141+
with:
142+
files: |
143+
${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.deb
144+
${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.rpm
145+
133146
- name: upload artifacts to cloud object storage
134147
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
135148
env:
@@ -138,13 +151,5 @@ jobs:
138151
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
139152
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
140153
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
154+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.deb
155+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-${{ env.OS }}-${{ env.FILE_ARCH }}-glibc.rpm

0 commit comments

Comments
 (0)