Add mandatory PHPUnit CI workflow and GitHub FUNDING.yml#1
Conversation
Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/7cc63a2c-3e17-479e-8d6c-bfca1ee08d49 Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/8bb07850-7b03-4937-90ca-56d96cb98035 Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/1a0fcd1e-d612-4b56-8a0f-685a18b704ca Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dacoto/gtfs-rt-php/sessions/1a0fcd1e-d612-4b56-8a0f-685a18b704ca Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces GitHub Actions CI for PHPUnit and adds repository sponsorship configuration, while also bringing in a full proto3 GTFS-Realtime definition and its generated PHP bindings (plus tooling and examples) to support PHP 8.4+ with google/protobuf v5.
Changes:
- Add GitHub Actions workflows for running PHPUnit on PRs/pushes and for regenerating protobuf PHP classes.
- Add proto3
gtfs-realtime.proto, generated PHP classes undersrc/, and a regeneration script. - Add PHPUnit configuration, tests, examples, and project metadata (Composer config, README, license, funding).
Reviewed changes
Copilot reviewed 52 out of 54 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/FUNDING.yml | Configures GitHub Sponsors and external donation links. |
| .github/workflows/tests.yml | Runs PHPUnit in CI on pushes/PRs targeting master/main. |
| .github/workflows/generate.yml | Workflow to regenerate protobuf PHP classes and push updates to the repo. |
| .gitignore | Ignores vendor output, composer.lock, generated example artifact, and PHPUnit cache. |
| LICENSE | Adds MIT license text for the project. |
| README.md | Adds usage docs, installation instructions, and regeneration guidance. |
| composer.json | Defines package metadata, PHP/protobuf requirements, and autoload mappings. |
| phpunit.xml | Configures PHPUnit test suite and source inclusion. |
| gtfs-realtime.proto | Adds the GTFS-Realtime proto definition converted to proto3 + PHP options. |
| bin/generate.sh | Script to download matching protoc and regenerate PHP code from the proto file. |
| examples/create_message.php | Example showing how to build and serialize a FeedMessage. |
| examples/parse_message.php | Example showing how to read and parse a serialized FeedMessage. |
| tests/GtfsRealtimeTest.php | PHPUnit coverage for basic object creation and serialization behavior. |
| src/GPBMetadata/GtfsRealtime.php | Generated descriptor metadata for all GTFS-Realtime message types. |
| src/Google/Transit/Realtime/Alert.php | Generated Alert message class. |
| src/Google/Transit/Realtime/Alert/Cause.php | Generated Alert.Cause enum class. |
| src/Google/Transit/Realtime/Alert/Effect.php | Generated Alert.Effect enum class. |
| src/Google/Transit/Realtime/Alert/SeverityLevel.php | Generated Alert.SeverityLevel enum class. |
| src/Google/Transit/Realtime/EntitySelector.php | Generated EntitySelector message class. |
| src/Google/Transit/Realtime/FeedEntity.php | Generated FeedEntity message class. |
| src/Google/Transit/Realtime/FeedHeader.php | Generated FeedHeader message class. |
| src/Google/Transit/Realtime/FeedHeader/Incrementality.php | Generated FeedHeader.Incrementality enum class. |
| src/Google/Transit/Realtime/FeedMessage.php | Generated FeedMessage message class. |
| src/Google/Transit/Realtime/Position.php | Generated Position message class. |
| src/Google/Transit/Realtime/ReplacementStop.php | Generated ReplacementStop message class. |
| src/Google/Transit/Realtime/Shape.php | Generated Shape message class. |
| src/Google/Transit/Realtime/Stop.php | Generated Stop message class. |
| src/Google/Transit/Realtime/Stop/WheelchairBoarding.php | Generated Stop.WheelchairBoarding enum class. |
| src/Google/Transit/Realtime/StopSelector.php | Generated StopSelector message class. |
| src/Google/Transit/Realtime/TimeRange.php | Generated TimeRange message class. |
| src/Google/Transit/Realtime/TranslatedImage.php | Generated TranslatedImage message class. |
| src/Google/Transit/Realtime/TranslatedImage/LocalizedImage.php | Generated TranslatedImage.LocalizedImage message class. |
| src/Google/Transit/Realtime/TranslatedString.php | Generated TranslatedString message class. |
| src/Google/Transit/Realtime/TranslatedString/Translation.php | Generated TranslatedString.Translation message class. |
| src/Google/Transit/Realtime/TripDescriptor.php | Generated TripDescriptor message class. |
| src/Google/Transit/Realtime/TripDescriptor/ModifiedTripSelector.php | Generated TripDescriptor.ModifiedTripSelector message class. |
| src/Google/Transit/Realtime/TripDescriptor/ScheduleRelationship.php | Generated TripDescriptor.ScheduleRelationship enum class. |
| src/Google/Transit/Realtime/TripModifications.php | Generated TripModifications message class. |
| src/Google/Transit/Realtime/TripModifications/Modification.php | Generated TripModifications.Modification message class. |
| src/Google/Transit/Realtime/TripModifications/SelectedTrips.php | Generated TripModifications.SelectedTrips message class. |
| src/Google/Transit/Realtime/TripUpdate.php | Generated TripUpdate message class. |
| src/Google/Transit/Realtime/TripUpdate/StopTimeEvent.php | Generated TripUpdate.StopTimeEvent message class. |
| src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate.php | Generated TripUpdate.StopTimeUpdate message class. |
| src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.php | Generated TripUpdate.StopTimeUpdate.ScheduleRelationship enum class. |
| src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.php | Generated TripUpdate.StopTimeUpdate.StopTimeProperties message class. |
| src/Google/Transit/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties/DropOffPickupType.php | Generated StopTimeProperties.DropOffPickupType enum class. |
| src/Google/Transit/Realtime/TripUpdate/TripProperties.php | Generated TripUpdate.TripProperties message class. |
| src/Google/Transit/Realtime/VehicleDescriptor.php | Generated VehicleDescriptor message class. |
| src/Google/Transit/Realtime/VehicleDescriptor/WheelchairAccessible.php | Generated VehicleDescriptor.WheelchairAccessible enum class. |
| src/Google/Transit/Realtime/VehiclePosition.php | Generated VehiclePosition message class. |
| src/Google/Transit/Realtime/VehiclePosition/CarriageDetails.php | Generated VehiclePosition.CarriageDetails message class. |
| src/Google/Transit/Realtime/VehiclePosition/CongestionLevel.php | Generated VehiclePosition.CongestionLevel enum class. |
| src/Google/Transit/Realtime/VehiclePosition/OccupancyStatus.php | Generated VehiclePosition.OccupancyStatus enum class. |
| src/Google/Transit/Realtime/VehiclePosition/VehicleStopStatus.php | Generated VehiclePosition.VehicleStopStatus enum class. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: Tests | ||
|
|
||
| on: |
There was a problem hiding this comment.
The PR title/description says this change is limited to adding a PHPUnit CI workflow + FUNDING.yml, but this PR also adds a large amount of generated protobuf source code, a code-generation workflow, composer/phpunit config, examples, etc. Please update the PR title/description to reflect the full scope (or split into smaller PRs) so reviewers/maintainers can accurately assess impact.
| # Include the version of protoc used in the commit message | ||
| PROTOC_VERSION=$(grep -oP '"google/protobuf":\s*"\K[^"]+' composer.json || echo "unknown") | ||
| git commit -m "chore: regenerate PHP classes (google/protobuf ${PROTOC_VERSION})" |
There was a problem hiding this comment.
The comment says the commit message includes the protoc version, but the variable is derived from the google/protobuf constraint in composer.json. Either rename this to reflect that it’s the protobuf PHP package version, or capture the actual protoc version used (especially when protoc_version is overridden).
| # Include the version of protoc used in the commit message | |
| PROTOC_VERSION=$(grep -oP '"google/protobuf":\s*"\K[^"]+' composer.json || echo "unknown") | |
| git commit -m "chore: regenerate PHP classes (google/protobuf ${PROTOC_VERSION})" | |
| # Include the google/protobuf PHP package version used in the commit message | |
| PROTOBUF_PHP_VERSION=$(grep -oP '"google/protobuf":\s*"\K[^"]+' composer.json || echo "unknown") | |
| git commit -m "chore: regenerate PHP classes (google/protobuf ${PROTOBUF_PHP_VERSION})" |
| require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
|
||
| use Google\Transit\Realtime\FeedMessage; | ||
| use Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship; |
There was a problem hiding this comment.
Unused import: ScheduleRelationship is imported but never referenced in this example. Removing it avoids confusion and keeps the example minimal.
| use Google\Transit\Realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship; |
| $this->assertSame('route-1', $entity->getTripUpdate()->getTrip()->getRouteId()); | ||
| $this->assertSame(1, count($entity->getTripUpdate()->getStopTimeUpdate())); | ||
| $this->assertSame(60, $entity->getTripUpdate()->getStopTimeUpdate()[0]->getArrival()->getDelay()); | ||
| $this->assertSame(90, $entity->getTripUpdate()->getStopTimeUpdate()[0]->getDeparture()->getDelay()); |
There was a problem hiding this comment.
These assertions use count(...) inside assertSame(...). PHPUnit provides assertCount(...), which gives better failure output and intent. Consider switching to assertCount(1, ...) / assertCount(3, ...) in this test file.
| @@ -0,0 +1,97 @@ | |||
| <?php | |||
| # Generated by the protocol buffer compiler. DO NOT EDIT! | |||
| # NO CHECKED-IN PROTOBUF GENCODE | |||
There was a problem hiding this comment.
The generated file header says "NO CHECKED-IN PROTOBUF GENCODE", but this repository is checking the generated code in. This is misleading for contributors; consider removing/adjusting this header during generation (or documenting why generated files are intentionally committed).
| # NO CHECKED-IN PROTOBUF GENCODE | |
| # Generated protobuf code (intentionally checked in; do not modify by hand). |
No CI pipeline existed to gate merges, and there was no sponsorship configuration.
Changes
.github/workflows/tests.yml— runs the existing PHPUnit suite on every push and PR targetingmaster/main(PHP 8.4). Job namePHPUnit (PHP 8.4)can be added as a required status check in branch protection rules. Scoped topermissions: contents: read..github/FUNDING.yml— wires up the GitHub Sponsors button with three platforms:dacotodacotoWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/da52fbc6bb574bfa6693ee2c86f9096f7b7f003b/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/exporter/zipball/70a298763b40b213ec087c51c739efcaa90bcd74/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2c1ed04922802c15e1de5d7447b4856de949cf56/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/phpunit/zipball/adc7262fccc12de2b30f12a8aa0b33775d814f00/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/JrrV7F /usr/bin/composer install --no-interaction --prefer-dist --ignore-platform-reqs(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.