-
Notifications
You must be signed in to change notification settings - Fork 37
176 lines (161 loc) · 6.15 KB
/
pack-libs.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
172
173
174
175
176
name: PHP Pack Lib
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 5"
release:
types:
- published
pull_request:
branches: [ "main" ]
paths:
- 'src/**'
- 'config/**'
- '.github/workflows/test-pack-lib.yml'
- 'bin/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
name: "Pack ${{ matrix.lib }} for ${{ matrix.runner }}"
runs-on: ${{ matrix.runner }}
timeout-minutes: 240
strategy:
matrix:
runner:
- ubuntu-latest
- ubuntu-20.04
- macos-13
- windows-2019
- macos-14
lib:
- zlib
- pkg-config
- bzip2
- gmp
- sqlite
- liblz4
- openssl
- brotli
- libargon2
- libiconv
- libavif
- libpng
- libtiff
- icu
- libcares
- libevent
- libsodium
- libwebp
- libyaml
- ncurses
- onig
- readline
- unixodbc
- xz
- grpc
exclude:
- { runner: "windows-2019", lib: "pkg-config" }
- { runner: "windows-2019", lib: "gmp" }
- { runner: "windows-2019", lib: "liblz4" }
- { runner: "windows-2019", lib: "brotli" }
- { runner: "windows-2019", lib: "libargon2" }
- { runner: "windows-2019", lib: "libiconv" }
- { runner: "windows-2019", lib: "libtiff" }
- { runner: "windows-2019", lib: "icu" }
- { runner: "windows-2019", lib: "libcares" }
- { runner: "windows-2019", lib: "libevent" }
- { runner: "windows-2019", lib: "libsodium" }
- { runner: "windows-2019", lib: "ncurses" }
- { runner: "windows-2019", lib: "readline" }
- { runner: "windows-2019", lib: "unixodbc" }
- { runner: "windows-2019", lib: "grpc" }
fail-fast: false
steps:
- name: "Process env string"
id: process-env
shell: bash
run: |
case "${{ matrix.runner }}" in
ubuntu-latest)
echo "OS=linux" >> "$GITHUB_OUTPUT"
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
echo "CMD=bin/spc-alpine-docker" >> "$GITHUB_OUTPUT"
;;
ubuntu-20.04)
echo "OS=linux" >> "$GITHUB_OUTPUT"
echo "ARCH=aarch64" >> "$GITHUB_OUTPUT"
echo CMD="SPC_USE_ARCH=aarch64 bin/spc-alpine-docker" >> "$GITHUB_OUTPUT"
;;
windows-2019)
echo "OS=windows" >> "$GITHUB_OUTPUT"
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT"
;;
macos-13)
echo "OS=darwin" >> "$GITHUB_OUTPUT"
echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT"
;;
macos-14)
echo "OS=darwin" >> "$GITHUB_OUTPUT"
echo "ARCH=aarch64" >> "$GITHUB_OUTPUT"
echo "CMD=bin/spc" >> "$GITHUB_OUTPUT"
;;
esac
- name: "Checkout remote"
if: github.repository != 'crazywhalecc/static-php-cli'
uses: actions/checkout@v4
with:
repository: crazywhalecc/static-php-cli
ref: main
- name: "Setup PHP"
if: matrix.runner != 'ubuntu-20.04'
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: pecl, composer
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
- name: "Cache composer packages"
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php
# Cache downloaded source
- id: cache-download
uses: actions/cache@v4
with:
path: downloads
key: pack-lib-dependencies
- name: "Install Dependencies"
if: matrix.runner != 'ubuntu-20.04'
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- run: ${{ steps.process-env.outputs.CMD }} doctor --auto-fix
- run: ${{ steps.process-env.outputs.CMD }} download --for-libs="${{ matrix.lib }}" --debug --retry=5 --shallow-clone
- name: "Download pre-built pkg-config for ${{ matrix.runner }}"
if: matrix.runner != 'windows-2019' && matrix.lib != 'pkg-config'
run: |
${{ steps.process-env.outputs.CMD }} download --for-libs="pkg-config" --debug --retry=5 --shallow-clone --prefer-pre-built
${{ steps.process-env.outputs.CMD }} build:libs pkg-config --debug
- if: matrix.runner != 'windows-2019' || matrix.lib != 'pkg-config'
run: ${{ steps.process-env.outputs.CMD }} dev:pack-lib --debug ${{ matrix.lib }}
- name: "Upload packed lib (${{ matrix.lib }} for ${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }})"
uses: actions/upload-artifact@v4
with:
path: dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz
name: ${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}
- name: "Upload to current release event"
if: github.repository == 'static-php/static-php-cli-hosted' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz
- name: "Update latest release of hosted repo"
if: github.repository == 'static-php/static-php-cli-hosted' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
shell: bash
run: |
ref="$(gh release view --repo static-php/static-php-cli-hosted --json tagName --jq '.tagName')"
gh release upload "$ref" "dist/${{ matrix.lib }}-${{ steps.process-env.outputs.ARCH }}-${{ steps.process-env.outputs.OS }}.txz" --repo static-php/static-php-cli-hosted --clobber