Skip to content

Commit d937e78

Browse files
committed
Move to new file structure
1 parent 03d0a33 commit d937e78

File tree

96 files changed

+451
-168
lines changed

Some content is hidden

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

96 files changed

+451
-168
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src @chr-hertel @Nyholm
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: '🐞 Bug Report'
3+
about: Report a bug in existing features
4+
title: ''
5+
labels: ['Bug']
6+
assignees: ''
7+
8+
---
9+
10+
<!-- ======================== Guidelines ============================
11+
12+
Thank you for taking the time to report a bug! 🙏
13+
14+
Please follow these guidelines to help us understand & fix the issue:
15+
16+
Describe Your Problem 🎯
17+
- Clearly explain the problem you're facing;
18+
- Describe what you expected to happen versus what actually occurred;
19+
- List the steps to reproduce the bug.
20+
21+
Provide Detailed Information 📋
22+
- Share relevant details: Component version, errors, screenshots;
23+
- If possible, provide a minimal reproducer in a GitHub repository.
24+
25+
Be Kind and Respectful 🙂
26+
- Stay patient & open to feedback, and act with kindness and respect;
27+
- Remember that this is a volunteer-driven project.
28+
29+
============================= Guidelines ======================== -->
30+
31+
32+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: '🚀 Feature Request'
3+
about: Suggest ideas for new features or enhancements
4+
title: ''
5+
labels: ['RFC']
6+
assignees: ''
7+
8+
---
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: '📖 Documentation'
3+
about: Help us improve the documentation!
4+
title: ''
5+
labels: 'docs'
6+
assignees: ''
7+
8+
---
9+

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: 🛟 Support / help
4+
url: https://symfony.com/support
5+
about: Ask your questions about Symfony AI

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| Q | A
2+
| ------------- | ---
3+
| Bug fix? | yes/no
4+
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
5+
| Docs? | yes/no <!-- required for new features -->
6+
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
7+
| License | MIT
8+
9+
<!--
10+
Replace this notice by a description of your feature/bugfix.
11+
This will help reviewers and should be a good start for the documentation.
12+
13+
Additionally (see https://symfony.com/releases):
14+
- Always add tests and ensure they pass.
15+
- For new features, provide some code snippets to help understand usage.
16+
- Features and deprecations must be submitted against branch main.
17+
- Update/add documentation as required (we can help!)
18+
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
19+
- Never break backward compatibility (see https://symfony.com/bc).
20+
-->

.github/build-packages.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
/**
4+
* Updates the composer.json files to use the local version of the Symfony AI packages.
5+
*/
6+
7+
require __DIR__.'/../vendor/autoload.php';
8+
9+
use Symfony\Component\Finder\Finder;
10+
11+
$finder = (new Finder())
12+
->in([__DIR__.'/../src/*/', __DIR__.'/../src/*/src/Bridge/*/'])
13+
->depth(0)
14+
->name('composer.json')
15+
;
16+
17+
// 1. Find all AI packages
18+
$aiPackages = [];
19+
foreach ($finder as $composerFile) {
20+
$json = file_get_contents($composerFile->getPathname());
21+
if (null === $packageData = json_decode($json, true)) {
22+
passthru(sprintf('composer validate %s', $composerFile->getPathname()));
23+
exit(1);
24+
}
25+
26+
if (str_starts_with($composerFile->getPathname(), __DIR__ . '/../src/')) {
27+
$packageName = $packageData['name'];
28+
29+
$aiPackages[$packageName] = [
30+
'path' => realpath($composerFile->getPath()),
31+
];
32+
}
33+
}
34+
35+
// 2. Update all composer.json files from the repository, to use the local version of the AI packages
36+
foreach ($finder as $composerFile) {
37+
$json = file_get_contents($composerFile->getPathname());
38+
if (null === $packageData = json_decode($json, true)) {
39+
passthru(sprintf('composer validate %s', $composerFile->getPathname()));
40+
exit(1);
41+
}
42+
43+
$repositories = $packageData['repositories'] ?? [];
44+
45+
foreach ($aiPackages as $packageName => $packageInfo) {
46+
if (isset($packageData['require'][$packageName])
47+
|| isset($packageData['require-dev'][$packageName])
48+
) {
49+
$repositories[] = [
50+
'type' => 'path',
51+
'url' => $packageInfo['path'],
52+
];
53+
$key = isset($packageData['require'][$packageName]) ? 'require' : 'require-dev';
54+
$packageData[$key][$packageName] = '@dev';
55+
}
56+
}
57+
58+
if ($repositories) {
59+
$packageData['repositories'] = $repositories;
60+
}
61+
62+
$json = json_encode($packageData, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
63+
file_put_contents($composerFile->getPathname(), $json."\n");
64+
}

.github/workflows/.utils.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
_run_task() {
2+
local ok=0
3+
local title="$1"
4+
local start=$(date -u +%s)
5+
OUTPUT=$(bash -xc "$2" 2>&1) || ok=$?
6+
local end=$(date -u +%s)
7+
8+
if [[ $ok -ne 0 ]]; then
9+
printf "\n%-70s%10s\n" $title $(($end-$start))s
10+
echo "$OUTPUT"
11+
echo "Job exited with: $ok"
12+
echo -e "\n::error::KO $title\\n"
13+
else
14+
printf "::group::%-68s%10s\n" $title $(($end-$start))s
15+
echo "$OUTPUT"
16+
echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::"
17+
fi
18+
19+
exit $ok
20+
}
21+
export -f _run_task

.github/workflows/code-quality.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'src/*/doc/**'
7+
- 'src/**/*.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'src/*/doc/**'
11+
- 'src/**/*.md'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
cs-php:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.3'
25+
tools: php-cs-fixer
26+
- name: php-cs-fixer
27+
run: php-cs-fixer check --diff
28+
29+
phpstan:
30+
name: PHPStan
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
php-version: [ '8.1', '8.2', '8.3', '8.4']
36+
dependency-version: ['']
37+
symfony-version: ['']
38+
minimum-stability: ['stable']
39+
include:
40+
# lowest deps
41+
- php-version: '8.1'
42+
dependency-version: 'lowest'
43+
# LTS version of Symfony
44+
- php-version: '8.1'
45+
symfony-version: '6.4.*'
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Configure environment
51+
run: |
52+
echo COLUMNS=120 >> $GITHUB_ENV
53+
echo COMPOSER_MIN_STAB='composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }} --ansi' >> $GITHUB_ENV
54+
echo COMPOSER_UP='composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' || '' }} --no-progress --no-interaction --ansi' >> $GITHUB_ENV
55+
echo COMPOSER_VALIDATE='composer validate --strict' >> $GITHUB_ENV
56+
echo PHPSTAN='vendor/bin/phpstan' >> $GITHUB_ENV
57+
58+
echo "Packages: $PACKAGES"
59+
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
60+
61+
- name: Setup PHP
62+
uses: shivammathur/setup-php@v2
63+
with:
64+
php-version: '8.1'
65+
tools: flex
66+
67+
- name: Install root dependencies
68+
run: composer install
69+
70+
- name: Build root packages
71+
run: php .github/build-packages.php
72+
73+
- name: Run PHPStan on packages
74+
run: |
75+
source .github/workflows/.utils.sh
76+
77+
echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_MIN_STAB && $COMPOSER_UP && $COMPOSER_VALIDATE && $PHPSTAN)'"

.github/workflows/doctor-rst.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: RST Linter
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.rst'
7+
- 'src/*/doc/**'
8+
pull_request:
9+
paths:
10+
- '**.rst'
11+
- 'src/*/doc/**'
12+
13+
jobs:
14+
doctor-rst:
15+
name: DOCtor-RST
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Create cache dir
22+
run: mkdir .cache
23+
24+
- name: Extract base branch name
25+
run: echo "branch=$(echo ${GITHUB_BASE_REF:=${GITHUB_REF##*/}})" >> $GITHUB_OUTPUT
26+
id: extract_base_branch
27+
28+
- name: Cache DOCtor-RST
29+
uses: actions/cache@v4
30+
with:
31+
path: .cache
32+
key: doctor-rst-${{ steps.extract_base_branch.outputs.branch }}
33+
34+
- name: DOCtor-RST
35+
uses: docker://oskarstark/doctor-rst
36+
with:
37+
args: --short --error-format=github --cache-file=/github/workspace/.cache/doctor-rst.cache

0 commit comments

Comments
 (0)