Skip to content

Commit 21195ab

Browse files
committed
Initial code to get Box for phar building
1 parent be8eb90 commit 21195ab

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

.github/workflows/phar-build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build PHAR
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+
28+
steps:
29+
- name: "Checkout"
30+
uses: "actions/checkout@v4"
31+
32+
- name: "Install PHP"
33+
uses: "shivammathur/setup-php@v2"
34+
with:
35+
coverage: none
36+
tools: composer:v2
37+
php-version: "${{ matrix.php-version }}"
38+
ini-values: memory_limit=-1
39+
40+
- name: "Get Composer Cache Directory"
41+
id: composer-cache
42+
run: |
43+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
44+
45+
- name: "Cache Composer dependencies"
46+
uses: "actions/cache@v3"
47+
with:
48+
path: "${{ steps.composer-cache.outputs.dir }}"
49+
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
50+
restore-keys: |
51+
php-${{ matrix.php-version }}-locked-composer-
52+
53+
- name: "Install locked dependencies"
54+
run: "composer install --no-interaction --no-progress"
55+
56+
- name: "Build PHAR file"
57+
run: "composer build:phar"
58+
59+
- name: "Test PHAR file"
60+
run: "./spc.phar dev:extensions"
61+
62+
- uses: actions/upload-artifact@v3
63+
with:
64+
name: spc-phar
65+
path: spc.phar

box.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"alias": "spc-php.phar",
3+
"banner": false,
4+
"blacklist": [
5+
".github",
6+
"tests"
7+
],
8+
"git-commit-short": "git_commit_short",
9+
"output": "spc.phar"
10+
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"captainhook/captainhook": "^5.10",
2121
"captainhook/plugin-composer": "^5.3",
2222
"friendsofphp/php-cs-fixer": "^3.25",
23+
"humbug/box": "^4.3",
2324
"nunomaduro/collision": "^7.8",
2425
"phpstan/phpstan": "^1.10",
2526
"phpunit/phpunit": "^10.3"
@@ -44,7 +45,8 @@
4445
"scripts": {
4546
"analyse": "phpstan analyse --memory-limit 300M",
4647
"cs-fix": "php-cs-fixer fix",
47-
"test": "vendor/bin/phpunit tests/ --no-coverage"
48+
"test": "vendor/bin/phpunit tests/ --no-coverage",
49+
"build:phar": "vendor/bin/box compile"
4850
},
4951
"config": {
5052
"allow-plugins": {

0 commit comments

Comments
 (0)