Skip to content

Commit 8ac72c5

Browse files
committed
↖️↗️ Choice. The problem is choice.
-- The Architect, The Matrix Reloaded (2003)
0 parents  commit 8ac72c5

File tree

204 files changed

+28971
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+28971
-0
lines changed

.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
* text=auto eol=lf
2+
3+
/resources/all-versions.json -diff linguist-generated=true
4+
/tests/.pest/snapshots -diff linguist-generated=true
5+
/tests/data -diff linguist-generated=true
6+
7+
# Ignore everything.
8+
/* export-ignore
9+
10+
# Export white-listed production code only.
11+
/bin -export-ignore
12+
/resources -export-ignore
13+
/src -export-ignore
14+
/composer.json -export-ignore
15+
/composer.lock -export-ignore
16+
/LICENSE -export-ignore
17+
/README.md -export-ignore
18+
19+
# Ignore internal scripts.
20+
/bin/update-all-version -export-ignore

.github/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fixes:
2+
- "php-matrix/::" # reduce root e.g., "php-matrix/src/" => "src/"

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: composer
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
- package-ecosystem: github-actions
9+
directory: /
10+
schedule:
11+
interval: weekly

.github/workflows/auto-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Auto Commit
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref_name }}
11+
cancel-in-progress: true
12+
13+
permissions: {}
14+
15+
jobs:
16+
pint:
17+
uses: typisttech/.github/.github/workflows/auto-pint.yml@v1
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
secrets:
22+
pr-write-pat-token: ${{ secrets.PR_WRITE_PAT_TOKEN }}
23+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Taken from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
2+
# and https://github.com/dependabot/fetch-metadata/blob/06ea45a2e4582d87b11f03c7ce596ae3261f39f6/README.md?plain=1#L133-L160
3+
name: Dependabot Auto-merge
4+
5+
on: pull_request
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
9+
cancel-in-progress: true
10+
11+
permissions: {}
12+
13+
jobs:
14+
dependabot:
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
uses: typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v1
19+
with:
20+
minor: true
21+
patch: true

.github/workflows/test.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
14+
cancel-in-progress: true
15+
16+
permissions: {}
17+
18+
jobs:
19+
pest:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.4'
27+
coverage: none
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- uses: "ramsey/composer-install@v3"
32+
with:
33+
composer-options: "--optimize-autoloader"
34+
35+
- run: composer pest:unit -- --ci --coverage-clover coverage-unit.xml
36+
- run: composer pest:feature -- --ci --coverage-clover coverage-feature.xml
37+
38+
- uses: actions/upload-artifact@v4
39+
if: ${{ matrix.coverage == 'xdebug' }}
40+
with:
41+
name: coverage
42+
path: |
43+
coverage-unit.xml
44+
coverage-feature.xml
45+
46+
pest:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: '8.4'
54+
coverage: none
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- uses: "ramsey/composer-install@v3"
59+
with:
60+
composer-options: "--optimize-autoloader"
61+
62+
- run: composer pest:unit -- --ci --coverage-clover coverage-unit.xml
63+
- run: composer pest:feature -- --ci --coverage-clover coverage-feature.xml
64+
65+
- uses: actions/upload-artifact@v4
66+
if: ${{ matrix.coverage == 'xdebug' }}
67+
with:
68+
name: coverage
69+
path: coverage.xml
70+
71+
codecov:
72+
needs: pest
73+
runs-on: ubuntu-latest
74+
permissions:
75+
id-token: write
76+
steps:
77+
- uses: actions/download-artifact@v4
78+
with:
79+
name: coverage
80+
81+
- uses: codecov/codecov-action@v5
82+
with:
83+
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
84+
fail_ci_if_error: true
85+
disable_search: true
86+
files: coverage-unit.xml
87+
flags: unit
88+
- uses: codecov/codecov-action@v5
89+
with:
90+
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
91+
fail_ci_if_error: true
92+
disable_search: true
93+
files: coverage-feature.xml
94+
flags: feature

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Composer template
2+
composer.phar
3+
/vendor/
4+
/coverage*.xml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Typist Tech Limited
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Whitespace-only changes.

bin/php-matrix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
declare(strict_types=1);
5+
6+
include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
7+
8+
use Symfony\Component\Console\Application;
9+
use TypistTech\PhpMatrix\Command\SatisfyCommand;
10+
11+
// TODO: How to auto-bump version on tag?
12+
$application = new Application('php-matrix', '0.1.0');
13+
14+
$application->add(new SatisfyCommand);
15+
16+
$application->run();

bin/update-all-versions

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
declare(strict_types=1);
5+
6+
use TypistTech\PhpMatrix\Releases\PhpNetReleases;
7+
8+
include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
9+
10+
define('ALL_VERSIONS_FILE', __DIR__ . '/../resources/all-versions.json');
11+
12+
$releases = new PhpNetReleases;
13+
$data = $releases->all();
14+
15+
$content = json_encode($data, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
16+
file_put_contents(ALL_VERSIONS_FILE, $content);

composer.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"name": "typisttech/php-matrix",
3+
"description": "TODO.",
4+
"type": "project",
5+
"keywords": [
6+
"ci",
7+
"cli",
8+
"github-actions"
9+
],
10+
"homepage": "https://github.com/typisttech/php-matrix",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Typist Tech",
15+
"homepage": "https://typist.tech"
16+
},
17+
{
18+
"name": "Tang Rufus",
19+
"email": "tangrufus@gmail.com",
20+
"homepage": "https://tangrufus.com",
21+
"role": "Developer"
22+
}
23+
],
24+
"support": {
25+
"issues": "https://github.com/typisttech/php-matrix/issues",
26+
"source": "https://github.com/typisttech/php-matrix"
27+
},
28+
"require": {
29+
"php": "^8.4",
30+
"composer-runtime-api": "^2.2",
31+
"composer/semver": "^3.4",
32+
"guzzlehttp/guzzle": "^7.9",
33+
"symfony/console": "^7.2"
34+
},
35+
"require-dev": {
36+
"laravel/pint": "^1.10",
37+
"mockery/mockery": "^1.6",
38+
"pestphp/pest": "^3.5",
39+
"roave/security-advisories": "dev-latest"
40+
},
41+
"autoload": {
42+
"psr-4": {
43+
"TypistTech\\PhpMatrix\\": "src/"
44+
}
45+
},
46+
"autoload-dev": {
47+
"psr-4": {
48+
"Tests\\": "tests/"
49+
}
50+
},
51+
"scripts": {
52+
"data:update": [
53+
"curl 'https://www.php.net/releases/index.php?json&max=1000&version=5' | jq . > ./tests/data/releases-5.json",
54+
"curl 'https://www.php.net/releases/index.php?json&max=1000&version=7' | jq . > ./tests/data/releases-7.json",
55+
"curl 'https://www.php.net/releases/index.php?json&max=1000&version=8' | jq . > ./tests/data/releases-8.json",
56+
"@php ./bin/update-all-versions",
57+
"pest --update-snapshots --parallel"
58+
],
59+
"pint": "pint",
60+
"pest": "pest",
61+
"pest:e2e": "pest --group=e2e --parallel",
62+
"pest:feature": "pest --group=feature --parallel",
63+
"pest:unit": "pest --group=unit --parallel",
64+
"test": [
65+
"pint --test",
66+
"pest --parallel"
67+
]
68+
},
69+
"config": {
70+
"allow-plugins": {
71+
"pestphp/pest-plugin": true
72+
},
73+
"sort-packages": true
74+
},
75+
"bin": [
76+
"bin/php-matrix"
77+
]
78+
}

0 commit comments

Comments
 (0)