From 25f6571492e1a546251611a121bf7c1f29f7ca87 Mon Sep 17 00:00:00 2001 From: Mohammad Mortazavi Date: Mon, 23 Oct 2023 13:27:22 +0330 Subject: [PATCH 1/4] Update php.yml --- .github/workflows/php.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 70c1181..1fb2dda 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,10 +1,6 @@ name: PHP Composer -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +on: [push, pull_request] permissions: contents: read @@ -13,14 +9,23 @@ jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + php: [ 8.1, 8.2, 8.3 ] + dependency-version: [ prefer-stable ] + + name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: ${{ matrix.php }} extensions: xdebug ini-values: xdebug.mode="coverage" coverage: xdebug @@ -28,14 +33,16 @@ jobs: - name: Validate composer.json and composer.lock run: composer validate --strict - - name: Cache Composer packages + - name: Get Composer cache directory id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer packages uses: actions/cache@v3 with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- + path: ${{ steps.composer-cache.outputs.dir }} + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - name: Install dependencies run: composer install --prefer-dist --no-progress From ec4a2a08fd3c185779d9930c6ce07e91277836dc Mon Sep 17 00:00:00 2001 From: Mohammad Mortazavi Date: Mon, 23 Oct 2023 13:29:48 +0330 Subject: [PATCH 2/4] Update php.yml --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1fb2dda..0468fe6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -8,7 +8,7 @@ permissions: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: From a7ec8baeebda9b27a5e15961bdbea62d6daa6731 Mon Sep 17 00:00:00 2001 From: Mohammad Mortazavi Date: Mon, 23 Oct 2023 13:36:15 +0330 Subject: [PATCH 3/4] separate job for uploading coverage report; --- .github/workflows/php.yml | 44 +++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 0468fe6..e60803e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -26,9 +26,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: xdebug - ini-values: xdebug.mode="coverage" - coverage: xdebug - name: Validate composer.json and composer.lock run: composer validate --strict @@ -45,16 +42,37 @@ jobs: key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - name: Install dependencies - run: composer install --prefer-dist --no-progress + run: composer install --prefer-dist --no-interaction --no-suggest - name: Run test suite - run: composer run-script test:coverage + run: composer run-script test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - flags: unittests - name: starter-codecov - fail_ci_if_error: true \ No newline at end of file + upload-coverage: + + runs-on: ubuntu-latest + needs: build + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: xdebug + ini-values: xdebug.mode="coverage" + coverage: xdebug + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-suggest + + - name: Run test suite + run: composer run-script test:coverage + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + name: lyra-codecov + fail_ci_if_error: true \ No newline at end of file From f3a5fab66232e15fe971cf558e07774aa48d2151 Mon Sep 17 00:00:00 2001 From: Mohammad Mortazavi Date: Mon, 23 Oct 2023 14:22:01 +0330 Subject: [PATCH 4/4] Revert "separate job for uploading coverage report;" This reverts commit a7ec8baeebda9b27a5e15961bdbea62d6daa6731. --- .github/workflows/php.yml | 44 ++++++++++++--------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index e60803e..0468fe6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -26,6 +26,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} + extensions: xdebug + ini-values: xdebug.mode="coverage" + coverage: xdebug - name: Validate composer.json and composer.lock run: composer validate --strict @@ -42,37 +45,16 @@ jobs: key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest + run: composer install --prefer-dist --no-progress - name: Run test suite - run: composer run-script test + run: composer run-script test:coverage - upload-coverage: - - runs-on: ubuntu-latest - needs: build - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: xdebug - ini-values: xdebug.mode="coverage" - coverage: xdebug - - - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-suggest - - - name: Run test suite - run: composer run-script test:coverage - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - name: lyra-codecov - fail_ci_if_error: true \ No newline at end of file + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: starter-codecov + fail_ci_if_error: true \ No newline at end of file