Merge pull request #16 from throttr/stat-implemented #78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
size: [uint8, uint16, uint32, uint64] | |
services: | |
throttr: | |
image: ghcr.io/throttr/throttr:5.0.9-debug-${{ matrix.size }}-AMD64-metrics-enabled | |
ports: | |
- 9000:9000 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.4' | |
coverage: pcov | |
extensions: swoole | |
- name: Validate Composer | |
run: composer validate --strict | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run tests with coverage | |
run: | | |
for i in {1..10}; do | |
nc -z localhost 9000 && echo "β throttr running ... " && break | |
echo "β³ Try $i: waiting 1s..." | |
sleep 1 | |
done | |
nc -z localhost 9000 || (echo "β throttr isn't running on port 9000" && exit 1) | |
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml | |
env: | |
THROTTR_SIZE: ${{ matrix.size }} | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.size == 'uint16' }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.xml |