-
Notifications
You must be signed in to change notification settings - Fork 36
149 lines (125 loc) · 4.92 KB
/
macos-x86_64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: build-swoole-cli-macos-x86_64
on: [ push, pull_request ]
jobs:
macos-x86_64:
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[macos-x86_64]')"
runs-on: macos-13
# macos-latest (macos-14) 变更了 CPU 架构,由 x86_64 变更为 arm64
# macos-14 CPU 架构 arm64
# macos-13 CPU 架构 x86_64
# macos-12 CPU 架构 x86_64
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
steps:
- uses: actions/checkout@v4
- name: Show Environment Info
run: |
set -x
uname -s
uname -m
uname -r
env
echo $HOME
sw_vers
xcodebuild -version
brew config
xcrun --show-sdk-path
ls -lh $(xcrun --show-sdk-path)
ifconfig
export IPV6=$(ifconfig en0 | grep "inet6 " | grep -v "inet6 fe80:" | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
export IPV4=$(ifconfig en0 | grep "inet " | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
echo $IPV4
echo $IPV6
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
- name: Prepare Build Environment
run: |
bash sapi/quickstart/macos/macos-init.sh
export PATH=/usr/local/opt/libtool/bin:$PATH
ls -lha /usr/local/opt/libtool/bin/
libtoolize --version
libtool --help-all
# brew bison --debug
CURRENT_USER=$(whoami)
echo ${CURRENT_USER}
sudo mkdir -p /usr/local/swoole-cli
CURRENT_USER=$(whoami) && sudo chown -R ${CURRENT_USER}:staff /usr/local/swoole-cli
git submodule update --init
- name: Cache PHP Runtime
uses: actions/cache@v4
id: php-runtime-cache
with:
path: ${{ github.workspace }}/bin/runtime
key: ${{ runner.os }}-x86_64-php-runtime
- name: Cache PHP Vendor
uses: actions/cache@v4
id: php-vendor-cache
with:
path: ${{ github.workspace }}/vendor
key: ${{ runner.os }}-x86_64-php-vendor
- name: Cache Dependency Source Code Tarball
uses: actions/cache@v4
id: pool-cache
with:
path: ${{ github.workspace }}/pool/
key: source-code-tarball-pool
- name: Cache all-library
uses: actions/cache@v4
id: all-library-cache
with:
path: /usr/local/swoole-cli
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library
- name: Prepare Runtime and Libraries and Extensions
run: |
set -x
mkdir -p pool/lib
mkdir -p pool/ext
mkdir -p bin/runtime
if [ ! -f bin/runtime/php ] ; then
bash sapi/quickstart/setup-php-runtime.sh
fi
bash sapi/download-box/download-box-get-archive-from-server.sh
ls -A pool/lib/
ls -A /usr/local/swoole-cli/
- name: prepare
run: |
export PATH=${{ github.workspace }}/bin/runtime:$PATH
alias php="php -d curl.cainfo=${{ github.workspace }}/bin/runtime/cacert.pem -d openssl.cafile=${{ github.workspace }}/bin/runtime/cacert.pem"
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1
- name: Build
run: |
export PATH=${{ github.workspace }}/bin/runtime:$PATH
bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
bash ./make.sh archive
- name: Show Build Result
run: |
./bin/swoole-cli -v
./bin/swoole-cli -m
./bin/swoole-cli --ri swoole
file ./bin/swoole-cli
otool -L ./bin/swoole-cli
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}')
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
./bin/swoole-cli -r "echo PHP_VERSION;"
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php
- name: Archive production artifacts debug
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-macos-x64-debug
retention-days: 90
path: ./bin/swoole-cli
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-macos-x64
retention-days: 90
path: ./bin/dist/swoole-cli
- name: gh release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz