Skip to content

Commit

Permalink
Merge branch 'main' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
LKaemmerling authored Aug 5, 2024
2 parents bbd79e1 + 35d5a68 commit b9cf139
Show file tree
Hide file tree
Showing 16 changed files with 812 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/blackbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
run: composer install --prefer-dist --no-interaction --no-suggest

- name: Compose Blackbox environment
run: docker-compose up -d
run: docker compose up -d
- name: Run Blackbox with APC
run: docker-compose run phpunit env ADAPTER=apc vendor/bin/phpunit tests/Test/
run: docker compose run phpunit env ADAPTER=apc vendor/bin/phpunit tests/Test/
- name: Run Blackbox with APCng
run: docker-compose run phpunit env ADAPTER=apcng vendor/bin/phpunit tests/Test/
run: docker compose run phpunit env ADAPTER=apcng vendor/bin/phpunit tests/Test/
- name: Run Blackbox with Redis
run: docker-compose run phpunit env ADAPTER=redis vendor/bin/phpunit tests/Test/
run: docker compose run phpunit env ADAPTER=redis vendor/bin/phpunit tests/Test/



1 change: 0 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
fail-fast: false
matrix:
php:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.0, 8.1, 8.2, 8.3 ]
php: [ 8.1, 8.2, 8.3 ]
dependency-version: [ prefer-lowest, prefer-stable ]
redis-version: [ 5, 6, 7 ]

Expand All @@ -20,6 +20,11 @@ jobs:
REDIS_HOST: redis
# The default Redis port
REDIS_PORT: 6379
# MySQL
DB_DATABASE: test
DB_USER: root
DB_PASSWORD: root

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -40,9 +45,23 @@ jobs:

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
- name: Execute tests

- name: Execute tests (PDO with Sqlite)
run: vendor/bin/phpunit

- name: Start MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e "CREATE DATABASE IF NOT EXISTS $DB_DATABASE;" -u$DB_USER -p$DB_PASSWORD
- name: Execute PDO tests with MySQL
env:
TEST_PDO_DSN: 'mysql:host=localhost;dbname=test'
TEST_PDO_USERNAME: 'root'
TEST_PDO_PASSWORD: 'root'
run: vendor/bin/phpunit tests/Test/Prometheus/PDO
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ $registry = new CollectorRegistry(new APC());
```
(see the `README.APCng.md` file for more details)

Using the PDO storage:
```php
$registry = new CollectorRegistry(new \PDO('mysql:host=localhost;dbname=prometheus', 'username', 'password'));
or
$registry = new CollectorRegistry(new \PDO('sqlite::memory:'));
```

### Advanced Usage

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"suggest": {
"ext-redis": "Required if using Redis.",
"ext-apc": "Required if using APCu.",
"ext-pdo": "Required if using PDO.",
"promphp/prometheus_push_gateway_php": "An easy client for using Prometheus PushGateway.",
"symfony/polyfill-apcu": "Required if you use APCu on PHP8.0+"
},
Expand Down
Loading

0 comments on commit b9cf139

Please sign in to comment.