Skip to content

Commit 7d29cc6

Browse files
authored
Merge pull request #112 from jolicode/phar-a-on
Refactore how we build the phar
2 parents 7c032cc + 8fa3b26 commit 7d29cc6

File tree

15 files changed

+3437
-1826
lines changed

15 files changed

+3437
-1826
lines changed

.github/actions/phar/action.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,12 @@ runs:
77
- name: Setup PHP
88
uses: shivammathur/setup-php@v2
99
with:
10-
php-version: "8.1"
11-
12-
- name: Install dependencies (lib)
13-
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --classmap-authoritative
14-
shell: bash
15-
16-
- name: Install dependencies (PHAR builder)
17-
run: composer install --prefer-dist --no-progress --optimize-autoloader --classmap-authoritative
18-
shell: bash
19-
working-directory: tools/phar
10+
php-version: "8.3"
11+
tools: castor
2012

2113
- name: Compile PHAR
22-
run: vendor/bin/box compile
14+
run: castor phar:compile
2315
shell: bash
24-
working-directory: tools/phar
2516

2617
- name: Ensure PHAR is OK
2718
run: build/jolitypo.phar --version

.github/workflows/build-phar.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Build the PHAR
33
on:
44
push:
55
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
68

79
permissions:
810
contents: read

castor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
*/
99

1010
Castor\import(__DIR__ . '/website/castor.php');
11+
Castor\mount(__DIR__ . '/tools/cli/');
12+
Castor\mount(__DIR__ . '/tools/phar/');

tools/cli/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.castor.stub.php
2+
/vendor/

tools/phar/bin/jolitypo renamed to tools/cli/bin/jolitypo

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use Symfony\Component\Console\Style\SymfonyStyle;
1111
use Symfony\Component\Finder\Finder;
1212

1313
require __DIR__ . '/../vendor/autoload.php';
14-
require __DIR__ . '/../../../vendor/autoload.php';
1514

1615
$help = <<<EOTXT
1716

tools/cli/castor.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of JoliTypo - a project by JoliCode.
5+
*
6+
* This software consists of voluntary contributions made by many individuals
7+
* and is licensed under the MIT license.
8+
*/
9+
10+
namespace cli;
11+
12+
use Castor\Attribute\AsTask;
13+
14+
use function Castor\io;
15+
use function Castor\run;
16+
17+
#[AsTask(description: 'install dependencies')]
18+
function install(): void
19+
{
20+
io()->title('Install phar dependencies');
21+
22+
run(['composer', 'install']);
23+
}
24+
25+
#[AsTask(description: 'update dependencies')]
26+
function update(): void
27+
{
28+
io()->title('Update phar dependencies');
29+
run(['composer', 'update']);
30+
}

tools/cli/composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "jolicode/jolitypo-phar",
3+
"description": "Tooling for building JoliTypo PHAR",
4+
"type": "project",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Grégoire Pineau",
9+
"email": "[email protected]"
10+
},
11+
{
12+
"name": "Mathieu Santostefano",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"repositories": [
17+
{
18+
"type": "path",
19+
"url": "../.."
20+
}
21+
],
22+
"require": {
23+
"jolicode/jolitypo": "*@dev",
24+
"symfony/console": "^7.2",
25+
"symfony/finder": "^7.2"
26+
},
27+
"config": {
28+
"bump-after-update": true,
29+
"optimize-autoloader": true,
30+
"platform": {
31+
"php": "8.3.20"
32+
},
33+
"sort-packages": true
34+
}
35+
}

0 commit comments

Comments
 (0)