Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
34cffdf
wip
cleptric Jun 27, 2025
ea0d385
Move code to subfolder to allow package without dependencies
stayallive Aug 25, 2025
21a3fc9
test CI build
Litarnus Sep 3, 2025
6f334f6
use php72 compatible phpstan
Litarnus Sep 3, 2025
12ed03b
update agent dir
Litarnus Sep 3, 2025
05b5dae
wip
Litarnus Sep 3, 2025
7d1cae0
wip
Litarnus Sep 3, 2025
0112421
commit phar on merge to main
Litarnus Sep 3, 2025
c4748d6
craft & release workflow
Litarnus Sep 3, 2025
3420e9c
Update .craft.yml
Litarnus Sep 4, 2025
c58e6a2
fix index
Litarnus Sep 4, 2025
2887222
Update .github/workflows/ci.yaml
Litarnus Sep 4, 2025
aa2b02c
Update .github/workflows/ci.yaml
Litarnus Sep 4, 2025
23fd4b2
Update .github/workflows/ci.yaml
Litarnus Sep 4, 2025
be46d61
Update .github/workflows/phpstan.yaml
Litarnus Sep 4, 2025
0ad705b
Update .github/workflows/phpstan.yaml
Litarnus Sep 4, 2025
e82b047
Update agent/composer.json
Litarnus Sep 4, 2025
ac25830
updates
Litarnus Sep 4, 2025
2e007a5
Merge remote-tracking branch 'origin/phar-build' into phar-build
Litarnus Sep 4, 2025
5215d73
wip
cleptric Sep 4, 2025
30e8b3f
Add PHAR artifact [skip ci]
github-actions[bot] Sep 4, 2025
df73393
wip
cleptric Sep 4, 2025
538f37b
Add PHAR artifact
github-actions[bot] Sep 4, 2025
4c823df
wip
Litarnus Sep 4, 2025
5f17c5e
Add PHAR artifact
github-actions[bot] Sep 4, 2025
b0c3903
wip
Litarnus Sep 4, 2025
9a53e34
Merge remote-tracking branch 'origin/phar-build' into phar-build
Litarnus Sep 4, 2025
0ec28db
Add PHAR artifact
github-actions[bot] Sep 4, 2025
ecbec55
wip
Litarnus Sep 4, 2025
cc1dde6
wip
Litarnus Sep 4, 2025
8c26aea
Add PHAR artifact
github-actions[bot] Sep 4, 2025
b868d26
Add PHAR artifact
github-actions[bot] Sep 4, 2025
c7cde45
Add PHAR artifact
github-actions[bot] Sep 4, 2025
dae94cd
wip
Litarnus Sep 4, 2025
cd4963d
Merge remote-tracking branch 'origin/phar-build' into phar-build
Litarnus Sep 4, 2025
48a7d60
Add PHAR artifact
github-actions[bot] Sep 4, 2025
59a368a
wip
Litarnus Sep 4, 2025
8f6b7a8
wip
Litarnus Sep 4, 2025
e1e1519
wip
Litarnus Sep 4, 2025
2e5dcae
wip
Litarnus Sep 4, 2025
1bd535e
Add PHAR artifact
github-actions[bot] Sep 4, 2025
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
9 changes: 9 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
minVersion: 0.23.1
changelogPolicy: simple
artifactProvider:
name: none
targets:
- name: github
- name: registry
sdks:
composer:sentry/sentry-agent:
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Exclude non-essential files from dist
/tests export-ignore
/stubs export-ignore
/scripts export-ignore
/examples export-ignore
/.appveyor.yml export-ignore
/.craft.yml export-ignore
/.editorconfig export-ignore
Expand All @@ -28,3 +30,6 @@
/codecov.yml export-ignore
/.github export-ignore
/phpbench.json export-ignore

# Exclude the agent package code, only the phar is needed for distribution
/agent export-ignore
4 changes: 2 additions & 2 deletions .github/workflows/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # pin@2.32.0
with:
php-version: '8.3'
php-version: '8.4'

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/phar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build PHAR

on:
pull_request:

permissions:
contents: read

jobs:
build-agent:
name: Build Agent
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Internal github app token
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
ref: ${{ github.head_ref || github.ref }}

- name: Setup PHP for agent dependencies
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
with:
php-version: '7.2'
tools: composer:v2

- name: Install dependencies
working-directory: agent
run: composer update --no-progress --no-interaction --prefer-dist

- name: Setup PHP for Box
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
with:
php-version: '8.4'
tools: box
ini-values: phar.readonly=0

- name: Build PHAR
run: scripts/build.sh
env:
COMPOSER_ROOT_VERSION: 0.1.0 # For reproducible PHAR builds
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit weird as we probably want it as constant as possible but the naming implies it should be dynamic


- name: Setup PHP for PHAR test
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4
with:
php-version: '7.2'

- name: Test PHAR
run: php bin/sentry-agent help

- name: Commit PHAR
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
add: "bin/sentry-agent bin/sentry-agent.sig"
message: "Add PHAR artifact"
default_author: github_actions
25 changes: 23 additions & 2 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # v2.35.4```
with:
php-version: '8.4'

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist

- name: Run script
run: vendor/bin/phpstan analyse

phpstan-agent:
name: PHPStan (agent)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./agent
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # pin@2.32.0
with:
php-version: '8.3'
php-version: '8.4'

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Prepare Release

on:
workflow_dispatch:
inputs:
version:
description: Version to release
required: true
force:
description: Force a release even when there are release-blockers (optional)
required: false
merge_target:
description: Target branch to merge into. Uses the default branch as a fallback (optional)
required: false
default: main

permissions:
contents: read

jobs:
release:
runs-on: ubuntu-latest
name: Release version
steps:
- name: Get auth token
id: token
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ steps.token.outputs.token }}
fetch-depth: 0

- name: Prepare release
uses: getsentry/action-prepare-release@v1
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
with:
version: ${{ github.event.inputs.version }}
force: ${{ github.event.inputs.force }}
merge_target: ${{ github.event.inputs.merge_target }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.lock
!agent/composer.lock
package.xml
/vendor
vendor
.idea
.php-cs-fixer.cache
.phpbench
Expand Down
6 changes: 3 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->append([
__DIR__ . '/sentry-agent',
->in([
__DIR__ . '/src',
__DIR__ . '/agent/src',
])
);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The agent is configured as a custom HTTP client for the [PHP](https://github.com
```php
Sentry\init([
'dsn' => '___PUBLIC_DSN___',
'http_client' => new Sentry\Agent\Transport\AgentClient(),
'http_client' => new \Sentry\Agent\Transport\AgentClient(),
]);
```

Expand Down
6 changes: 6 additions & 0 deletions agent/box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"main": "src/sentry-agent.php",
"output": "../bin/sentry-agent",
"alias": "sentry-agent.phar",
"timestamp": "20250904"
}
48 changes: 48 additions & 0 deletions agent/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "sentry/sentry-agent-internal",
"type": "library",
"description": "Sentry Agent for PHP (https://sentry.io)",
"homepage": "https://sentry.io",
"license": "MIT",
"authors": [
{
"name": "Sentry",
"email": "accounts@sentry.io"
}
],
"require": {
"php": "^7.2|^8.0",
"ext-json": "*",
"clue/mq-react": "^1.6",
"react/http": "^1.11",
"react/socket": "^1.16",
"sentry/sentry": "^4.15.0"
},
"autoload": {
"psr-4": {
"Sentry\\Agent\\": "src/"
}
},
"require-dev": {
"phpstan/phpstan": "1.12.5",
"phpunit/phpunit": "^8.5|^9.6"
},
"autoload-dev": {
"psr-4": {
"Sentry\\Agent\\Tests\\": "tests/"
}
},
"scripts": {
"check": [
"@phpstan",
"@tests"
],
"tests": "vendor/bin/phpunit --verbose",
"phpstan": "vendor/bin/phpstan analyse"
},
"config": {
"sort-packages": true,
"autoloader-suffix": "SentryAgentChecksum"
},
"prefer-stable": true
}
Loading