Skip to content

Commit

Permalink
Create experimental builder
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 16, 2023
1 parent 29d1705 commit 21a7516
Show file tree
Hide file tree
Showing 631 changed files with 25,836 additions and 10 deletions.
15 changes: 9 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
.* export-ignore
*.md export-ignore
generator export-ignore
tests export-ignore
docs export-ignore
examples export-ignore
mongo-orchestration export-ignore
stubs export-ignore
tools export-ignore
phpcs.xml.dist export-ignore
phpunit.evergreen.xml export-ignore
phpunit.xml.dist export-ignore
psalm.xml.dist export-ignore
psalm-baseline.xml export-ignore

# Keep generated files from displaying in diffs by default
# https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github
/src/Builder/Accumulator/*.php linguist-generated=true
/src/Builder/Expression/*.php linguist-generated=true
/src/Builder/Query/*.php linguist-generated=true
/src/Builder/Projection/*.php linguist-generated=true
/src/Builder/Stage/*.php linguist-generated=true
94 changes: 94 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
name: Bug Report
about: Report a bug for the MongoDB PHP Builder.
title: ''
labels: ''
assignees: ''

---

<!--
You are about to open an issue for the MongoDB PHP builder. If you instead
intended to report an issue with the MongoDB PHP library, please do so via its
repository[^1].
If you've identified a security vulnerability in a driver or any other MongoDB
project, please create a vulnerability report[^2].
[^1]: https://github.com/mongodb/mongo-php-library
[^2]: https://mongodb.com/docs/manual/tutorial/create-a-vulnerability-report
-->

### Bug Report

<!--
Briefly describe the issue. Feel free to cross-reference your report with any
other related GitHub or JIRA issues for additional context. Before reporting an
issue, check that you are using the most recent version of the driver.
-->

### Environment

<!--
What operating system and PHP version are you using? Mention if PHP was
installed through a third-party bundle (e.g. MAMP, XAMPP) and report its version
if applicable.
What version of MongoDB are you using? Include details about the topology (e.g.
replica set, sharded cluster) and how you are connecting to the database (e.g.
TLS connections, authentication). If possible, share your connection string and
additional URI options (be sure to redact any auth credentials). Please specify
whether you are self-hosting the database or using a cloud provider, such as
MongoDB Atlas.
Include version information for the extension, libmongoc, and libbson. This may
be collected by grepping phpinfo() output:
php -i | grep -E 'mongodb|libmongoc|libbson'
In some cases, it may be helpful to provide all phpinfo() output (e.g. `php -i`)
and/or list all installed extensions (e.g. `php -m`).
Include version information for the library. This may be
collected by running the following from your project's root directory:
composer show mongodb/mongodb
-->

### Test Script

<!--
If possible, attach a complete PHP script that can be executed on its own to
reproduce the issue. Clarify whether this script can be run from the CLI or if
it can must be run through a web SAPI.
If the error only presents itself in a web SAPI, note whether the issue can be
reproduced with PHP's built-in web server[^3]. If not, please share your web
server version and any relevant configuration details in the Environment section
above.
[^3]: https://php.net/manual/en/features.commandline.webserver.php
-->

### Expected and Actual Behavior

<!--
How did the script fail to perform the expected task? Feel free to include debug
and/or `var_dump()` output if that helps explain the error.
If the observed behavior is an unexpected exception, please include its full
message and any relevant backtrace information. If you encountered a
segmentation fault, please include a GDB backtrace[^4].
[^4]: https://bugs.php.net/bugs-generating-backtrace.php
-->

### Debug Log

<!--
If the issue relates to internal driver behavior (e.g. connection issues),
please include a debug log[^5]. This may be generated by setting the
`mongodb.debug` INI option to "stderr" or a directory (useful for web SAPIs).
[^5]: https://php.net/manual/en/mongodb.configuration.php#ini.mongodb.debug
-->
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
blank_issues_enabled: false

contact_links:
- name: New issue on mongodb/mongo-php-builder
url: https://github.com/mongodb/mongo-php-builder/issues/new/choose
about: Experiencing a problem with the MongoDB PHP library or extension? Please report it through the mongo-php-library or mongo-php-driver repository.
- name: MongoDB Developer Community Forums
url: https://developer.mongodb.com/community/forums/
about: For questions, discussions, or general technical support, visit the MongoDB Community Forums. The MongoDB Community Forums are a centralized place to connect with other MongoDB users, ask questions, and get answers.
- name: Report a Security Vulnerability
url: https://mongodb.com/docs/manual/tutorial/create-a-vulnerability-report
about: If you believe you have discovered a vulnerability in MongoDB products or have experienced a security incident related to MongoDB products, please report the issue to aid in its resolution.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
63 changes: 63 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"
push:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "mongodb/mongo-php-driver@master"

jobs:
phpcs:
name: "phpcs"
runs-on: "ubuntu-22.04"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ env.PHP_VERSION }}
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
key: "extcache-v1"

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr"

- name: "Show driver information"
run: "php --ri mongodb"

- name: "Install dependencies with Composer"
uses: "ramsey/[email protected]"
with:
composer-options: "--no-suggest"

# The -q option is required until phpcs v4 is released
- name: "Run PHP_CodeSniffer"
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
62 changes: 62 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"
push:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "mongodb/mongo-php-driver@master"

jobs:
psalm:
name: "Psalm"
runs-on: "ubuntu-22.04"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ env.PHP_VERSION }}
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
key: "extcache-v1"

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr"

- name: "Show driver information"
run: "php --ri mongodb"

- name: "Install dependencies with Composer"
uses: "ramsey/[email protected]"
with:
composer-options: "--no-suggest"

- name: "Run Psalm"
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc)"
112 changes: 112 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: "Tests"

on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"
push:
branches:
- "[0-9]+.[0-9]+"
- "feature/*"
paths-ignore:
- "docs/**"

jobs:
phpunit:
name: "PHPUnit tests"
runs-on: "${{ matrix.os }}"

strategy:
fail-fast: true
matrix:
os:
- "ubuntu-20.04"
php-version:
- "8.1"
- "8.2"
- "8.3"
mongodb-version:
- "4.4"
driver-version:
- "mongodb/mongo-php-driver@master"
topology:
- "server"
include:
- os: "ubuntu-20.04"
php-version: "8.1"
mongodb-version: "6.0"
driver-version: "mongodb/mongo-php-driver@master"
topology: "replica_set"
- os: "ubuntu-20.04"
php-version: "8.1"
mongodb-version: "6.0"
driver-version: "mongodb/mongo-php-driver@master"
topology: "sharded_cluster"
- os: "ubuntu-20.04"
php-version: "8.1"
mongodb-version: "5.0"
driver-version: "mongodb/mongo-php-driver@master"
topology: "server"
- os: "ubuntu-20.04"
php-version: "8.1"
mongodb-version: "4.4"
driver-version: "mongodb/mongo-php-driver@master"
topology: "replica_set"
- os: "ubuntu-20.04"
php-version: "8.1"
mongodb-version: "4.4"
driver-version: "mongodb/mongo-php-driver@master"
topology: "sharded_cluster"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: ${{ matrix.mongodb-version }}
topology: ${{ matrix.topology }}

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: "mongodb-${{ matrix.driver-version }}"
key: "extcache-v1"

- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "pecl"
extensions: "mongodb-${{ matrix.driver-version }}"
coverage: "none"
ini-values: "zend.assertions=1"

- name: "Show driver information"
run: "php --ri mongodb"

- name: "Install dependencies with Composer"
uses: "ramsey/[email protected]"
with:
composer-options: "--no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/simple-phpunit -v"
env:
SYMFONY_DEPRECATIONS_HELPER: 999999
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}
Loading

0 comments on commit 21a7516

Please sign in to comment.