Skip to content

Commit 153144e

Browse files
committed
Add new GH action to build binary SPC
1 parent f1d5916 commit 153144e

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/binary-build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build binary SPC
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-phar:
14+
name: "Build PHAR"
15+
16+
runs-on: ${{ matrix.operating-system }}
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
dependencies:
22+
- "locked"
23+
php-version:
24+
- "8.1"
25+
operating-system:
26+
- "ubuntu-latest"
27+
- "macos-latest"
28+
29+
steps:
30+
- name: "Checkout"
31+
uses: "actions/checkout@v4"
32+
33+
- name: "Install PHP"
34+
uses: "shivammathur/setup-php@v2"
35+
with:
36+
coverage: none
37+
tools: composer:v2
38+
php-version: "${{ matrix.php-version }}"
39+
ini-values: memory_limit=-1
40+
41+
- name: "Get Composer Cache Directory"
42+
id: composer-cache
43+
run: |
44+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
45+
46+
- name: "Cache Composer dependencies"
47+
uses: "actions/cache@v3"
48+
with:
49+
path: "${{ steps.composer-cache.outputs.dir }}"
50+
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
51+
restore-keys: |
52+
php-${{ matrix.php-version }}-locked-composer-
53+
54+
- name: "Install locked dependencies"
55+
run: "composer install --no-interaction --no-progress"
56+
57+
- name: "Cache SPC source files"
58+
uses: "actions/cache@v3"
59+
with:
60+
path: "source"
61+
key: "spc-${{ matrix.php-version }}-source-files-${{ github.run_id }}"
62+
restore-keys: |
63+
spc-${{ matrix.php-version }}-source-files-
64+
65+
- name: "Install SPC source files"
66+
run: "bin/spc download --all"
67+
68+
- name: "Build micro PHP binary for SPC"
69+
run: "bin/spc build pcntl,posix,mbstring,tokenizer,phar --build-micro"
70+
71+
- name: "Build PHAR file"
72+
run: "vendor/bin/box compile"
73+
74+
- name: "Combine PHAR & micro binary"
75+
run: "bin/spc micro:combine spc.phar"
76+
77+
- uses: actions/upload-artifact@v3
78+
with:
79+
path: spc-${{ matrix.operating-system }}-x86_64.tar.gz

0 commit comments

Comments
 (0)