From 57d0cb7dbdb9b35398494b2769df1df8a5843c25 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 18 May 2025 11:35:34 +0200 Subject: [PATCH 1/4] reuse CI workflow --- .github/workflows/ci.yml | 76 ++++++---------------------------------- 1 file changed, 10 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a151524..189105d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,72 +1,16 @@ name: CI -on: [push] +on: [push, pull_request] jobs: - phpunit: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macOS-latest] - php-version: ['8.2', '8.3'] - dependencies: ['lowest', 'highest'] - name: 'PHPUnit' - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: mbstring, intl - coverage: xdebug - - name: Composer - uses: "ramsey/composer-install@v2" - with: - dependency-versions: ${{ matrix.dependencies }} - - name: PHPUnit - run: php blackbox.php - env: - ENABLE_COVERAGE: 'true' - - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} + blackbox: + uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main + coverage: + uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main + secrets: inherit psalm: - runs-on: ubuntu-latest - strategy: - matrix: - php-version: ['8.2', '8.3'] - dependencies: ['lowest', 'highest'] - name: 'Psalm' - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: mbstring, intl - - name: Composer - uses: "ramsey/composer-install@v2" - with: - dependency-versions: ${{ matrix.dependencies }} - - name: Psalm - run: vendor/bin/psalm --shepherd + uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main cs: - runs-on: ubuntu-latest - strategy: - matrix: - php-version: ['8.2'] - name: 'CS' - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: mbstring, intl - - name: Composer - uses: "ramsey/composer-install@v2" - - name: CS - run: vendor/bin/php-cs-fixer fix --diff --dry-run + uses: innmind/github-workflows/.github/workflows/cs.yml@main + with: + php-version: '8.2' From ca8c7ba6ee330cc9470a1543218ffcd2884b6aa3 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 18 May 2025 11:35:55 +0200 Subject: [PATCH 2/4] add workflow to create releases --- .github/workflows/release.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b25ad8a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,11 @@ +name: Create release + +on: + push: + tags: + - '*' + +jobs: + release: + uses: innmind/github-workflows/.github/workflows/release.yml@main + secrets: inherit From bd557b2990d9c8eeaea10592d222331e174131ac Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 18 May 2025 11:39:13 +0200 Subject: [PATCH 3/4] use better assertion to show the invalid value --- tests/CurrentProcess/GenericTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CurrentProcess/GenericTest.php b/tests/CurrentProcess/GenericTest.php index fa27004..d97d639 100644 --- a/tests/CurrentProcess/GenericTest.php +++ b/tests/CurrentProcess/GenericTest.php @@ -63,6 +63,6 @@ public function testMemory() $process = Generic::of(Halt\Usleep::new()); $this->assertInstanceOf(Bytes::class, $process->memory()); - $this->assertTrue($process->memory()->toInt() > 6000000); // ~5MB + $this->assertGreaterThan(6_000_000, $process->memory()->toInt()); // ~5MB } } From 5acc811b138621a5af4675f54755f153849761fc Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 18 May 2025 11:41:03 +0200 Subject: [PATCH 4/4] decrease the minimum memory as the CI is not always running with xdebug --- tests/CurrentProcess/GenericTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CurrentProcess/GenericTest.php b/tests/CurrentProcess/GenericTest.php index d97d639..30e825a 100644 --- a/tests/CurrentProcess/GenericTest.php +++ b/tests/CurrentProcess/GenericTest.php @@ -63,6 +63,6 @@ public function testMemory() $process = Generic::of(Halt\Usleep::new()); $this->assertInstanceOf(Bytes::class, $process->memory()); - $this->assertGreaterThan(6_000_000, $process->memory()->toInt()); // ~5MB + $this->assertGreaterThan(3_000_000, $process->memory()->toInt()); // ~3MB } }