Skip to content

feat: add secretKey config, deprecate personalAPIKey (#199) #429

feat: add secretKey config, deprecate personalAPIKey (#199)

feat: add secretKey config, deprecate personalAPIKey (#199) #429

Workflow file for this run

name: "CI"
on:
pull_request:
push:
branches:
- main
paths:
- "**.php"
- "bin/posthog"
- "composer.json"
- "composer.lock"
- "phpcs.xml"
- "phpunit.xml"
- "api/public-api.json"
- "scripts/**"
- ".github/workflows/php.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
detect-markdown-only:
uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b
permissions:
pull-requests: read
composer-validate:
needs: detect-markdown-only
runs-on: ubuntu-latest
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
- name: Set up PHP
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: 8.4
tools: composer
- name: Validate composer files
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: composer validate --no-check-lock --no-check-version --strict
public-api:
needs: detect-markdown-only
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up PHP 8.4
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: 8.4
tools: composer
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Check public API snapshot
run: composer api:check
phpunit:
needs: detect-markdown-only
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [8.2, 8.3, 8.4, 8.5]
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
- name: Set up PHP ${{ matrix.php-version }}
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: ${{ matrix.php-version }}
tools: composer, phpunit
- name: Install Dependencies
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: composer install --prefer-dist --no-progress
- name: Run PHPUnit Tests
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml
coverage:
runs-on: ubuntu-latest
needs:
- detect-markdown-only
- phpunit
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up PHP 8.4
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: 8.4
extensions: xdebug
tools: composer, phpunit
- name: Install Dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHPUnit Coverage
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml --coverage-text
phpcs:
needs: detect-markdown-only
runs-on: ubuntu-latest
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
with:
fetch-depth: 0 # important!
# we may use whatever way to install phpcs, just specify the path on the next step
# however, curl seems to be the fastest
- name: Install PHP_CodeSniffer
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: |
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
php phpcs.phar --version
php phpcbf.phar --version
- name: Check PHP formatting
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: |
php phpcbf.phar --standard=phpcs.xml --no-colors || phpcbf_status=$?
if [ "${phpcbf_status:-0}" -gt 1 ]; then
exit "$phpcbf_status"
fi
git diff --exit-code -- lib test
- uses: tinovyatkin/action-php-codesniffer@0043b33b3629611c37e8bc7ee8a4e061dc9a7ea2 # v1
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: phpcs.xml
scope: "file"