From 825dfcc56fd1f72fc48c4cc220995f1913cc840e Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Wed, 31 Aug 2022 06:43:45 -0400 Subject: [PATCH] Use reusables actions. (#19) --- .github/workflows/build.yml | 61 ++++------------------------------ .github/workflows/mutation.yml | 57 +++++-------------------------- .github/workflows/static.yml | 51 ++++------------------------ .scrutinizer.yml | 8 ++--- 4 files changed, 26 insertions(+), 151 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70f79d2..f6c41aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,59 +22,12 @@ on: name: build jobs: - tests: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - env: + phpunit: + uses: yiisoft/actions/.github/workflows/phpunit.yml@master + with: extensions: pdo, pdo_sqlite - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - windows-latest - - php: - - 8.0 - - 8.1 - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - ini-values: date.timezone='UTC' - coverage: pcov - tools: composer:v2 - extensions: ${{ env.extensions }} - - - name: Determine composer cache directory on Linux - if: matrix.os == 'ubuntu-latest' - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Determine composer cache directory on Windows - if: matrix.os == 'windows-latest' - run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - - name: Update composer - run: composer self-update - - - name: Install dependencies with composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + os: >- + ['ubuntu-latest', 'windows-latest'] + php: >- + ['8.0', '8.1'] - - name: Run tests with phpunit - run: vendor/bin/phpunit --colors=always diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index b1cc6ac..d30ec36 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -21,53 +21,12 @@ name: mutation test jobs: mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - env: + uses: yiisoft/actions/.github/workflows/roave-infection.yml@master + with: extensions: pdo, pdo_sqlite - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - 8.1 - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - ini-values: memory_limit=-1 - coverage: pcov - tools: composer:v2 - extensions: ${{ env.extensions }} - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - - name: Update composer - run: composer self-update - - - name: Install dependencies with composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Run infection - run: | - vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered - env: - STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} + os: >- + ['ubuntu-latest'] + php: >- + ['8.1'] + secrets: + STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index c50088f..96b2679 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -22,47 +22,10 @@ on: name: static analysis jobs: - mutation: - name: PHP ${{ matrix.php }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php: - - 8.0 - - 8.1 - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer:v2, cs2pr - coverage: none - - - name: Determine composer cache directory - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Cache dependencies installed with composer - uses: actions/cache@v2 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php }}-composer- - - - name: Update composer - run: composer self-update - - - name: Install dependencies with composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Static analysis - run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize + psalm: + uses: yiisoft/actions/.github/workflows/psalm.yml@master + with: + os: >- + ['ubuntu-latest'] + php: >- + ['8.0', '8.1'] diff --git a/.scrutinizer.yml b/.scrutinizer.yml index f86aaa7..61fb502 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,16 +3,16 @@ checks: filter: paths: - - "src/*" + - src/ build: image: default-bionic environment: php: - version: 8.0.11 + version: 8.0.18 ini: - "xdebug.mode": coverage + xdebug.mode: coverage nodes: analysis: @@ -28,7 +28,7 @@ build: tests: override: - - command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml" + - command: ./vendor/bin/phpunit --coverage-clover ./coverage.xml on_node: 1 coverage: file: coverage.xml