From 7e2549a8e24e802915642e0ff6f897f6f3469edf Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 13 Sep 2022 18:31:35 +0400 Subject: [PATCH 1/4] Use reusable actions --- .github/workflows/run-tests.yml | 61 ++++++--------------------- .github/workflows/static-analysis.yml | 61 ++++++--------------------- 2 files changed, 26 insertions(+), 96 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7d729d0..5e6afa0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,51 +1,16 @@ -name: run-tests - on: - push: - pull_request: - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [ ubuntu-latest ] - php: [ 8.1 ] - stability: [ prefer-lowest, prefer-stable ] - - name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - - steps: - - name: Checkout code - uses: actions/checkout@v3 + pull_request: + push: + branches: + - master - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none +name: phpunit - - name: Validate Composer - run: composer validate - - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Restore Composer Cache - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer - - - name: Install Dependencies - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --prefer-dist --no-interaction --no-progress - - - name: Execute tests - run: vendor/bin/phpunit +jobs: + phpunit: + uses: spiral/gh-actions/.github/workflows/phpunit.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.1'] diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4143ed5..6b1563e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,51 +1,16 @@ -name: run-tests - on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - static-analysis: - name: Psalm - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - php: [ 8.1 ] - os: [ ubuntu-latest ] - - steps: - - name: Checkout - uses: actions/checkout@v3 + pull_request: + push: + branches: + - master - - name: Setup PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} +name: static analysis - - name: Validate Composer - run: composer validate - - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Restore Composer Cache - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer - - - name: Install Dependencies - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --prefer-dist --no-interaction --no-progress - - - name: Static Analysis - run: vendor/bin/psalm --no-cache +jobs: + psalm: + uses: spiral/gh-actions/.github/workflows/psalm.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.1', '8.2'] From 370b8f1cb97ebe74f874b43518b4043e4f0d7f2f Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 13 Sep 2022 18:33:11 +0400 Subject: [PATCH 2/4] Improve php versions --- .github/workflows/run-tests.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5e6afa0..e3bcdf7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,4 +13,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1'] + ['8.1', '8.2'] diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6b1563e..5eb674e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,4 +13,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1', '8.2'] + ['8.1'] From 7a4315cdd8bea5c3e4f76441dd4ba9157ffa8949 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 13 Sep 2022 18:39:07 +0400 Subject: [PATCH 3/4] Add stability parameter --- .github/workflows/{run-tests.yml => phpunit.yml} | 2 ++ 1 file changed, 2 insertions(+) rename .github/workflows/{run-tests.yml => phpunit.yml} (80%) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/phpunit.yml similarity index 80% rename from .github/workflows/run-tests.yml rename to .github/workflows/phpunit.yml index e3bcdf7..897470b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/phpunit.yml @@ -14,3 +14,5 @@ jobs: ['ubuntu-latest'] php: >- ['8.1', '8.2'] + stability: >- + [prefer-lowest, prefer-stable] From f5dc279f0c7fb77afb0f6fe3764bb52e43fc4c30 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Tue, 13 Sep 2022 18:40:05 +0400 Subject: [PATCH 4/4] ?? --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 897470b..75e9374 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -15,4 +15,4 @@ jobs: php: >- ['8.1', '8.2'] stability: >- - [prefer-lowest, prefer-stable] + ['prefer-lowest', 'prefer-stable']