-
Notifications
You must be signed in to change notification settings - Fork 29
171 lines (156 loc) · 6.84 KB
/
macos.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: macos test
on:
workflow_dispatch:
inputs:
libraries:
description: "libraries"
required: false
default: "zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2"
extensions:
description: "extensions"
required: false
default: "iconv,dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd,posix,pcntl,sysvshm,sysvsem,sysvmsg"
lib_only:
description: "build libraries only"
required: false
default: ""
push:
schedule:
- cron: "33 4 * * *"
env:
LWMBS_LIBRARIES: zstd,libssh2,curl,zlib,brotli,libffi,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2
LWMBS_EXTENSIONS: iconv,dom,xml,simplexml,xmlwriter,xmlreader,opcache,bcmath,pdo,phar,mysqlnd,mysqli,pdo,pdo_mysql,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,ffi,swow,redis,sockets,openssl,zip,zlib,bz2,yaml,zstd,posix,pcntl,sysvshm,sysvsem,sysvmsg
jobs:
macos:
name: PHP ${{ matrix.php-version }} ${{ matrix.arch }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.2", "8.1", "8.0"]
arch: ["x86_64", "arm64"]
max-parallel: 6
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Calc sources hash
id: src_hash
run: |
set -xeo pipefail
printf 'hash=' >> $GITHUB_OUTPUT
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php fetch_source.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--phpVer=${{ matrix.php-version }} \
--hash >> $GITHUB_OUTPUT
echo
- name: Cache libraries
uses: actions/cache@v3
id: cache
with:
path: |
build/src
build/downloads
build/lib
build/include
key: macos-${{ matrix.arch }}-v3-${{ steps.src_hash.outputs.hash }}
- name: Prepare tools and sources
run: |
set -xeo pipefail
brew install bison re2c automake autoconf
brew link automake
mkdir -p build
cd build
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php ../fetch_source.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--phpVer=${{ matrix.php-version }} \
--shallowClone
mkdir -p \
${GITHUB_WORKSPACE}/micro \
${GITHUB_WORKSPACE}/micro-cli \
${GITHUB_WORKSPACE}/cli
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/micro/licenses
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/micro-cli/licenses
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/cli/licenses
- name: Prepare libraries
if: steps.cache.outputs.cache-hit != 'true'
working-directory: build
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ../build_libs.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
--arch=${{ matrix.arch }}
- name: Build micro
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ${GITHUB_WORKSPACE}/build_micro.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }}
cp src/php-src/sapi/micro/micro.sfx src/php-src/sapi/micro/micro.sfx.dwarf ${GITHUB_WORKSPACE}/micro/
- name: Upload artifact for micro
if: steps.micro.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
micro
- name: Build micro-cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: micro-cli
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
rm -f src/php-src/sapi/micro/php_micro.lo
php ${GITHUB_WORKSPACE}/build_micro.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }} \
--fakeCli
cp src/php-src/sapi/micro/micro.sfx ${GITHUB_WORKSPACE}/micro-cli/micro-cli.sfx
cp src/php-src/sapi/micro/micro.sfx.dwarf ${GITHUB_WORKSPACE}/micro-cli/micro-cli.sfx.dwarf
- name: Upload artifact for micro-cli
if: steps.micro-cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: micro-cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
micro-cli
- name: Build cli
if: "! (github.event.inputs && github.event.inputs.lib_only)"
id: cli
working-directory: build
continue-on-error: true
run: |
set -xeo pipefail
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
php ${GITHUB_WORKSPACE}/build_cli.php \
"${{ (github.event.inputs && github.event.inputs.libraries) || env.LWMBS_LIBRARIES }}" \
"${{ (github.event.inputs && github.event.inputs.extensions) || env.LWMBS_EXTENSIONS }}" \
--arch=${{ matrix.arch }}
cp src/php-src/sapi/cli/php src/php-src/sapi/cli/php.dwarf ${GITHUB_WORKSPACE}/cli/
- name: Upload artifact for cli
if: steps.cli.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: cli_${{ matrix.php-version }}_${{ matrix.arch }}_${{ steps.src_hash.outputs.hash }}
path: |
cli
- name: Fail if anything failed
if: |
steps.cli.outcome == 'failure' ||
steps.micro.outcome == 'failure'
run: |
false
- name: Remove php src to avoid cache
run: |
rm -rf build/src/php-src