Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 56 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ on:
pull_request:
branches:
- "**"
# Every job only reads the repository; codecov is uploaded with its own token.
permissions:
contents: read
jobs:
check-lock-file-version:
name: NPM Lock File Version
timeout-minutes: 5
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check NPM lock file version
run: |
version=$(node -e "console.log(require('./package-lock.json').lockfileVersion)")
Expand All @@ -22,11 +25,15 @@ jobs:
exit 1
fi
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
include:
- name: PHP 8.5
PHP_VERSION: 8.5
- name: PHP 8.4
PHP_VERSION: 8.4
- name: PHP 8.3
PHP_VERSION: 8.3
- name: PHP 8.2
Expand All @@ -36,30 +43,67 @@ jobs:
fail-fast: false
name: Test ${{ matrix.name }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.17.1
node-version: 18
cache: npm
- name: Setup PHP ${{ matrix.PHP_VERSION }}
run: |
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install -y php${{ matrix.PHP_VERSION }} php${{ matrix.PHP_VERSION }}-mbstring php${{ matrix.PHP_VERSION }}-xml php${{ matrix.PHP_VERSION }}-curl
sudo apt-get install -y php${{ matrix.PHP_VERSION }} php${{ matrix.PHP_VERSION }}-mbstring php${{ matrix.PHP_VERSION }}-xml php${{ matrix.PHP_VERSION }}-curl php${{ matrix.PHP_VERSION }}-xdebug
sudo update-alternatives --set php /usr/bin/php${{ matrix.PHP_VERSION }}
php --version
- run: composer install
- name: Start MongoDB
run: |
docker run -d --name mongo -p 27017:27017 mongo:6.0 --replSet rs0
until docker exec mongo mongosh --quiet --eval 'db.runCommand({ping:1})' > /dev/null 2>&1; do sleep 1; done
docker exec mongo mongosh --quiet --eval 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27017"}]})'
until [ "$(docker exec mongo mongosh --quiet --eval 'rs.status().myState')" = "1" ]; do sleep 1; done
# `composer update` rather than `composer install`: a single lock file cannot
# cover PHP 8.1 to 8.5, since PHPUnit 10, 11 and 12 each support a different range.
- run: composer update --no-interaction --no-progress
- run: npm ci
- run: npm start
- name: Wait for the Parse test server
run: |
for i in $(seq 1 60); do
curl -sf http://localhost:1337/parse/health && exit 0
sleep 2
done
echo "::error::Parse test server did not come up"
exit 1
- run: npm run lint
- run: npm run test-stream
- run: npm run test:coverage
- run: npm run document-check
- run: npm run document
env:
CI: true
- run: bash <(curl -s https://codecov.io/bash)
docs:
name: Documentation
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
# phpDocumentor cannot be installed on PHP 8.5 yet, so docs are built on 8.4
- name: Setup PHP 8.4
run: |
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install -y php8.4 php8.4-mbstring php8.4-xml php8.4-curl
sudo update-alternatives --set php /usr/bin/php8.4
php --version
- name: Install phpDocumentor
env:
PHPDOC_VERSION: 3.10.0
PHPDOC_SHA256: fe1e7c23ba3329aa6f19ac3c807446159a431a195ec5d9163b0c281a15105207
run: |
mkdir -p tools
curl -sSL -o tools/phpDocumentor.phar \
"https://github.com/phpDocumentor/phpDocumentor/releases/download/v$PHPDOC_VERSION/phpDocumentor.phar"
echo "$PHPDOC_SHA256 tools/phpDocumentor.phar" | sha256sum --check --strict
chmod +x tools/phpDocumentor.phar
- run: npm run document-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
20 changes: 13 additions & 7 deletions .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
branches: [ master, release, alpha, beta ]
env:
NODE_VERSION: 18
PHP_VERSION: 8.1
PHP_VERSION: 8.4
jobs:
release:
runs-on: ubuntu-latest
outputs:
current_tag: ${{ steps.tag.outputs.current_tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm ci
Expand All @@ -24,7 +24,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tag on current commit
id: tag
run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')"
run: echo "current_tag=$(git describe --tags --abbrev=0 --exact-match || echo '')" >> "$GITHUB_OUTPUT"
docs-publish:
needs: release
if: needs.release.outputs.current_tag != ''
Expand All @@ -38,11 +38,11 @@ jobs:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ needs.release.outputs.current_tag }}
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup PHP ${{ env.PHP_VERSION }}
Expand All @@ -54,10 +54,16 @@ jobs:
php --version
- name: Generate Docs
run: |
composer install
mkdir -p tools
curl -sSL -o tools/phpDocumentor.phar \
"https://github.com/phpDocumentor/phpDocumentor/releases/download/v$PHPDOC_VERSION/phpDocumentor.phar"
echo "$PHPDOC_SHA256 tools/phpDocumentor.phar" | sha256sum --check --strict
chmod +x tools/phpDocumentor.phar
npm run document-check
npm run document
env:
PHPDOC_VERSION: 3.10.0
PHPDOC_SHA256: fe1e7c23ba3329aa6f19ac3c807446159a431a195ec5d9163b0c281a15105207
SOURCE_TAG: ${{ needs.release.outputs.current_tag }}
- name: Configure Pages
uses: actions/configure-pages@v5
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/release-manual-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'Version tag:'
env:
NODE_VERSION: 18
PHP_VERSION: 8.1
PHP_VERSION: 8.4
jobs:
docs-publish:
if: github.event.inputs.tag != ''
Expand All @@ -21,11 +21,11 @@ jobs:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup PHP ${{ env.PHP_VERSION }}
Expand All @@ -37,10 +37,16 @@ jobs:
php --version
- name: Generate Docs
run: |
composer install
mkdir -p tools
curl -sSL -o tools/phpDocumentor.phar \
"https://github.com/phpDocumentor/phpDocumentor/releases/download/v$PHPDOC_VERSION/phpDocumentor.phar"
echo "$PHPDOC_SHA256 tools/phpDocumentor.phar" | sha256sum --check --strict
chmod +x tools/phpDocumentor.phar
npm run document-check
npm run document
env:
PHPDOC_VERSION: 3.10.0
PHPDOC_SHA256: fe1e7c23ba3329aa6f19ac3c807446159a431a195ec5d9163b0c281a15105207
SOURCE_TAG: ${{ github.event.inputs.tag }}
- name: Configure Pages
uses: actions/configure-pages@v5
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ output/
.phpdoc/

composer.phar

# phpDocumentor phar, downloaded on demand
tools/
46 changes: 39 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Additionally you'll need to add some cloud code to it.
To get started:

* [Get Composer], the PHP package manager.
* Run `composer install` to download dependencies.
* Run `composer install` to download dependencies. The committed `composer.lock`
is resolved for the lowest supported PHP version; on PHP 8.3 and above run
`composer update` instead to get the matching PHPUnit release.

From here you have to setup an instance of parse server.
For your convenience we have included a testable version of parse server as a dev dependency.
Expand All @@ -26,7 +28,29 @@ To setup the Test Parse Server:
* Run `npm install` from the project root to download the server and it's dependencies.
* When you're ready to run tests use `npm start` from the project root to boot up the test server.

The test server is setup with the appropriate configuration to run the php sdk test suite. Additionally it handles setting up mongodb for the server. If you have a mongodb instance already running, you can use `npm run server-only`.
The test server is setup with the appropriate configuration to run the php sdk test suite. It expects a MongoDB replica set to be reachable on `mongodb://localhost/test`; `npm run server-only` is equivalent and does not background the process.

If those defaults clash with another Parse server or MongoDB instance running locally, the following environment variables are read by both the test server and the test suite:

| Variable | Default |
|---|---|
| `PARSE_TEST_HTTP_PORT` | `1337` |
| `PARSE_TEST_HTTPS_PORT` | `1338` |
| `PARSE_TEST_DATABASE_URI` | `mongodb://localhost/test` |

For instance:

PARSE_TEST_HTTP_PORT=11337 PARSE_TEST_HTTPS_PORT=11338 \
PARSE_TEST_DATABASE_URI=mongodb://127.0.0.1:27019/test npm start

PARSE_TEST_HTTP_PORT=11337 PARSE_TEST_HTTPS_PORT=11338 npm test

The TLS test server uses the certificates in `tests/keys`. They are generated by `tests/gencerts.sh`; once they expire, re-issue them from the existing private keys with:

RESIGN=1 ./tests/gencerts.sh parseca localhost parsephp tests/keys/
RESIGN=1 ./tests/gencerts.sh parseca client parsephp tests/keys/

and update the `peer_fingerprint` pinned in `tests/Parse/ParseClientTest.php` with the new SHA1 of `tests/keys/localhost.crt`.

If you have specific needs and would like to alter your test server you can fork and modify the aforementioned test project.
Alternately you can configure a compatible test server as follows:
Expand Down Expand Up @@ -78,14 +102,22 @@ You can automatically fix lint errors with phpcbf:

npm run lint:fix

Finally verify that your new changes are acceptable to phpdoc:

Finally verify that your new changes are acceptable to phpDocumentor. It is no
longer a Composer dev dependency, because it cannot be installed on PHP 8.5, so
grab the phar first (and run it with PHP 8.4 or older):

mkdir -p tools
curl -sSL -o tools/phpDocumentor.phar \
https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.10.0/phpDocumentor.phar
echo "fe1e7c23ba3329aa6f19ac3c807446159a431a195ec5d9163b0c281a15105207 tools/phpDocumentor.phar" | sha256sum --check --strict
chmod +x tools/phpDocumentor.phar
Comment thread
coderabbitai[bot] marked this conversation as resolved.
npm run document-check

The test suite is setup for code coverage if you have [XDebug] installed and setup.
Coverage is outputted as text and as html in the phpunit-test-results/ directory within the project root.
The test suite can produce code coverage if you have [XDebug] installed and setup:

npm run test:coverage

If you do not have XDebug tests will still run, just without coverage.
Coverage is written to coverage.xml in the project root.

Please make sure that any new functionality (or issues) you are working on are covered by tests when possible.
If you have XDebug setup and can view code coverage please ensure that you do your best to completely cover any new code you are adding.
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Coverage](http://codecov.io/github/parse-community/parse-php-sdk/coverage.svg?branch=master)](http://codecov.io/github/parse-community/parse-php-sdk?branch=master)
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases)

[![PHP Version](https://img.shields.io/badge/php-8.1,_8.2,_8.3-green.svg?logo=php&style=flat)](https://php.org/)
[![PHP Version](https://img.shields.io/badge/php-8.1,_8.2,_8.3,_8.4,_8.5-green.svg?logo=php&style=flat)](https://php.org/)

[![packagist latest version](https://img.shields.io/packagist/v/parse/php-sdk)](https://packagist.org/packages/parse/php-sdk)

Expand Down Expand Up @@ -71,12 +71,15 @@ The Parse PHP SDK is continuously tested with the most recent releases of PHP to

| Version | End-of-Life | Compatible |
|---------|-------------|------------|
| PHP 8.2 | Dec 2024 | ✅ Yes |
| PHP 8.1 | Nov 2023 | ✅ Yes |
| PHP 8.5 | Dec 2029 | ✅ Yes |
| PHP 8.4 | Dec 2028 | ✅ Yes |
| PHP 8.3 | Dec 2027 | ✅ Yes |
| PHP 8.2 | Dec 2026 | ✅ Yes |
| PHP 8.1 | Dec 2025 | ✅ Yes |

## Installation
There are various ways to install and use this sdk. We'll elaborate on a couple here.
Note that the Parse PHP SDK requires PHP 5.4 or newer. It can also run on HHVM (recommended 3.0 or newer).
Note that the Parse PHP SDK requires PHP 8.1 or newer.

### Install with Composer

Expand Down
17 changes: 5 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@
}
],
"require": {
"php": ">=8.1 <8.4",
"php": ">=8.1",
"ext-curl": "*",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "10.1.1",
"squizlabs/php_codesniffer": "3.7.2",
"phpdocumentor/phpdocumentor": "3.0.0",
"jms/serializer": "1.7.1",
"nikic/php-parser": "4.15"
"phpunit/phpunit": "^10.5.38 || ^11.4 || ^12.0",
"squizlabs/php_codesniffer": "^3.13"
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Parse\\": "src/Parse/"
Expand All @@ -33,10 +31,5 @@
"psr-4": {
"Parse\\Test\\": "tests/Parse/"
}
},
"config": {
"allow-plugins": {
"symfony/flex": true
}
}
}
Loading
Loading