-
Notifications
You must be signed in to change notification settings - Fork 36
191 lines (159 loc) · 6.4 KB
/
linux-mips64le.yaml
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: build-swoole-cli-linux-mips64le
on: [ push, pull_request ]
env:
BUILD_PHP_VERSION: 8.2.13
jobs:
linux-mips64le:
if: 0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare Source Code
run: |
echo $PATH
env
docker info
id -u
id -g
who
cat /etc/os-release
hostnamectl
uname -s
uname -m
uname -r
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
export IPV4=$(ip -4 address show | 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
echo "BUILD_PHP_VERSION=${{ matrix.php-version }}" >> $GITHUB_ENV
# git submodule update --init
sudo mkdir -p /usr/local/swoole-cli
uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
- 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 }}-mips64le-all-library
- name: Cache swoole-cli-builder-image
uses: actions/cache@v4
id: swoole-cli-builder-image-mips64le-cache
with:
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
key: ${{ runner.os }}-mips64le-swoole-cli-builder-image
- name: Prepare Libraries and Extensions
run: |
set -x
mkdir -p pool/lib
mkdir -p pool/ext
mkdir -p bin/runtime
CACHE_NUM=$(ls -A pool/lib/ | wc -l)
LIB_NUM=$(ls -A sapi/src/builder/library/ | wc -l)
echo `expr $LIB_NUM - $CACHE_NUM`
if test $CACHE_NUM -eq 0 ; then
bash sapi/download-box/download-box-get-archive-from-container.sh
fi
ls -A pool/lib/
ls -A /usr/local/swoole-cli/
- name: Prepare QEMU
run: |
set -x
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Prepare swoole-cli-builder-image
run: |
if [ -f ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar ] ; then
docker load -i ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
else
bash .github/workflows/build-debian-builder-container.sh --platform "linux/mips64le"
fi
- name: prepare pre-built library
if: 1
uses: addnab/docker-run-action@v3
with:
image: swoole-cli-builder:latest
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/swoole-cli/
run: |
for i in `ls /usr/local/swoole-cli/`
do
echo $i
done
uname -a
uname -s
uname -m
apt install -y php-dev php-cli
- name: Build
if: 0
uses: addnab/docker-run-action@v3
with:
image: swoole-cli-builder:latest
options: -v ${{ github.workspace }}:/work -w /work -e BUILD_PHP_VERSION=${{ env.BUILD_PHP_VERSION }} -v /usr/local/swoole-cli:/usr/local/swoole-cli
run: |
set -eux
uname -m
if [ ! -f bin/runtime/php ] ; then
bash setup-php-runtime.sh
fi
export PATH=/work/bin/runtime:$PATH # 容器已经内置 php 和 composer
alias php="php -d curl.cainfo=/work/bin/runtime/cacert.pem -d openssl.cafile=/work/bin/runtime/cacert.pem"
# sed -i 's/mirrors.tuna.tsinghua.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositories
# sed -i 's/mirrors.ustc.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositories
# bash sapi/quickstart/mark-install-library-cached.sh
sh sapi/quickstart/linux/alpine-init.sh
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +ffmpeg
bash make-install-deps.sh
bash make.sh all-library
bash make.sh config
bash make.sh build
bash make.sh archive
- name: Show Build Result
if: 0
uses: addnab/docker-run-action@v3
with:
image: swoole-cli-builder:latest
options: -v ${{ github.workspace }}:/work -w /work
run: |
./thirdparty/php-src/sapi/cli/php -v
file ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
readelf -h ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
APP_VERSION=$(./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php -v | head -n 1 | awk '{print $2}')
echo ${APP_VERSION}
echo ${APP_VERSION} > APP_VERSION
./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php -r "echo PHP_VERSION;"
- name: get app version
if: 0
run: |
APP_VERSION=$(cat ./APP_VERSION)
echo $APP_VERSION
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
- name: production artifacts debug
if: 0
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.APP_VERSION }}-linux-arm64-debug
retention-days: 90
path: ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
- name: production artifacts
if: 0
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.APP_VERSION }}-linux-arm64
retention-days: 90
path: ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/dist/php
- name: gh release
uses: softprops/action-gh-release@v2
if: 0 && startsWith(github.ref, 'refs/tags/')
with:
files: |
php-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz
php-cli-v${{ env.APP_VERSION }}-linux-arm64-debug.tar.xz