Skip to content

Commit 6c9ed64

Browse files
Tests (#25)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a6179d2 commit 6c9ed64

14 files changed

Lines changed: 912 additions & 70 deletions

.github/workflows/ci-agent.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Agent CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- release/**
9+
10+
permissions:
11+
contents: read
12+
13+
# Cancel in progress workflows on pull_requests.
14+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
tests:
21+
name: Tests (${{ matrix.os }}, ${{ matrix.php.version }}, ${{ matrix.dependencies }})
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- ubuntu-latest
28+
- windows-latest
29+
php:
30+
- { version: '7.2', phpunit: '^8.5.40' }
31+
- { version: '7.3', phpunit: '^9.6.21' }
32+
- { version: '7.4', phpunit: '^9.6.21' }
33+
- { version: '8.0', phpunit: '^9.6.21' }
34+
- { version: '8.1', phpunit: '^9.6.21' }
35+
- { version: '8.2', phpunit: '^9.6.21' }
36+
- { version: '8.3', phpunit: '^9.6.21' }
37+
- { version: '8.4', phpunit: '^9.6.21' }
38+
- { version: '8.5', phpunit: '^9.6.25' }
39+
dependencies:
40+
- lowest
41+
- highest
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v6
46+
with:
47+
fetch-depth: 2
48+
49+
- name: Setup PHP
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php.version }}
53+
coverage: xdebug
54+
55+
- name: Setup Problem Matchers for PHPUnit
56+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
57+
58+
- name: Determine Composer cache directory
59+
id: composer-cache
60+
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
61+
shell: bash
62+
63+
- name: Cache Composer dependencies
64+
uses: actions/cache@v4
65+
with:
66+
path: ${{ steps.composer-cache.outputs.directory }}
67+
key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
68+
restore-keys: ${{ runner.os }}-${{ matrix.php.version }}-${{ matrix.dependencies }}-composer-
69+
70+
- name: Remove unused dependencies
71+
run: composer config --unset platform.php
72+
working-directory: ./agent
73+
74+
# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
75+
- name: Remove unused dependencies
76+
run: composer remove phpstan/phpstan --dev --no-interaction --no-update
77+
working-directory: ./agent
78+
79+
- name: Set phpunit/phpunit version constraint
80+
run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update
81+
working-directory: ./agent
82+
83+
- name: Install highest dependencies
84+
run: composer update --no-progress --no-interaction --prefer-dist
85+
if: ${{ matrix.dependencies == 'highest' }}
86+
working-directory: ./agent
87+
88+
- name: Install lowest dependencies
89+
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
90+
if: ${{ matrix.dependencies == 'lowest' }}
91+
working-directory: ./agent
92+
93+
- name: Run unit tests
94+
run: vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml
95+
working-directory: ./agent

agent/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
"clue/mq-react": "^1.6",
1717
"react/http": "^1.11",
1818
"react/socket": "^1.16",
19-
"sentry/sentry": "^4.15.0"
19+
"sentry/sentry": "^4.19.1"
2020
},
2121
"autoload": {
2222
"psr-4": {
2323
"Sentry\\Agent\\": "src/"
2424
}
2525
},
2626
"require-dev": {
27-
"phpstan/phpstan": "1.12.5",
27+
"phpstan/phpstan": "^1.12",
2828
"phpunit/phpunit": "^8.5|^9.6"
2929
},
3030
"autoload-dev": {

0 commit comments

Comments
 (0)