From 326ae9a505894b75e641e8c423e59100d8c2438d Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Tue, 7 Feb 2023 19:03:32 +0100 Subject: [PATCH] ci: test with php 8.2 and simplify workflows (monicahq/chandler#424) --- .github/workflows/build_assets.yml | 5 ----- .github/workflows/lint_php.yml | 32 ++------------------------- .github/workflows/lint_vue.yml | 32 ++------------------------- .github/workflows/static_analysis.yml | 7 +----- .github/workflows/tests.yml | 13 +++++------ 5 files changed, 10 insertions(+), 79 deletions(-) diff --git a/.github/workflows/build_assets.yml b/.github/workflows/build_assets.yml index ec1bc0de425..2970fa7efdd 100644 --- a/.github/workflows/build_assets.yml +++ b/.github/workflows/build_assets.yml @@ -6,11 +6,6 @@ on: release: types: [created] - workflow_run: - workflows: [PHP linting (Pint), Javascript linting] - types: [completed] - branches-ignore: [main] - env: node-version: 18 diff --git a/.github/workflows/lint_php.yml b/.github/workflows/lint_php.yml index 05feb010560..5edcba30d6b 100644 --- a/.github/workflows/lint_php.yml +++ b/.github/workflows/lint_php.yml @@ -4,11 +4,6 @@ on: pull_request: types: [opened, synchronize, reopened] - workflow_run: - workflows: [Javascript linting] - types: [completed] - branches-ignore: [main] - concurrency: group: Lint php ${{ github.ref }} cancel-in-progress: true @@ -23,36 +18,15 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 - if: env.GH_TOKEN != '' - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - token: ${{ secrets.GH_TOKEN }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - uses: actions/checkout@v3 - if: env.GH_TOKEN == '' - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Checkout sources + uses: actions/checkout@v3 - name: laravel-pint uses: aglipanci/laravel-pint-action@1.0.0 with: preset: laravel - - name: Commit changes - if: env.GH_TOKEN != '' - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: 'chore: php linting with pint' - skip_fetch: true - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Check if there is any file update needed - if: env.GH_TOKEN == '' run: | status=$(git status --porcelain) if [ -n "$status" ]; then @@ -60,5 +34,3 @@ jobs: echo "::error::Laravel pint found fixes. Please run 'vendor/bin/pint' prior to your next commit." exit -1 fi - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/lint_vue.yml b/.github/workflows/lint_vue.yml index 9562018c300..b09387d008c 100644 --- a/.github/workflows/lint_vue.yml +++ b/.github/workflows/lint_vue.yml @@ -4,11 +4,6 @@ on: pull_request: types: [opened, synchronize, reopened] - workflow_run: - workflows: [PHP linting (Pint)] - types: [completed] - branches-ignore: [main] - concurrency: group: Lint js ${{ github.ref }} cancel-in-progress: true @@ -23,19 +18,8 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 - if: env.GH_TOKEN != '' - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - token: ${{ secrets.GH_TOKEN }} - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - - uses: actions/checkout@v3 - if: env.GH_TOKEN == '' - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Checkout sources + uses: actions/checkout@v3 # Yarn - name: Setup Node.js @@ -62,17 +46,7 @@ jobs: - name: Run prettier run: yarn run format - - name: Commit changes - if: env.GH_TOKEN != '' - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: 'chore: javascript linting with eslint and prettier' - skip_fetch: true - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Check if there is any file update needed - if: env.GH_TOKEN == '' run: | status=$(git status --porcelain) if [ -n "$status" ]; then @@ -80,5 +54,3 @@ jobs: echo "::error::Eslint and prettier found fixes. Please run 'yarn run lint' and 'yarn run format' prior to your next commit." exit -1 fi - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 77039acedc4..60631b67f99 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -4,13 +4,8 @@ on: pull_request: types: [opened, synchronize, reopened] - workflow_run: - workflows: [PHP linting (Pint), Javascript linting] - types: [completed] - branches-ignore: [main] - env: - php-version: '8.1' + php-version: '8.2' concurrency: group: Static ${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83ae9206718..52a6c3b033f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,13 +8,8 @@ on: release: types: [created] - workflow_run: - workflows: [PHP linting (Pint), Javascript linting] - types: [completed] - branches-ignore: [main] - env: - default-php-version: '8.1' + default-php-version: '8.2' coverage-with: sqlite concurrency: @@ -33,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.1'] + php-version: ['8.1', '8.2'] connection: [sqlite, mysql, pgsql] testsuite: [Unit] coverage: [true] # run test with coverage, if 'coverage-with' match with the connection @@ -55,6 +50,8 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: mbstring, dom, fileinfo, ${{ matrix.connection }} + coverage: pcov + ini-values: pcov.directory=., pcov.exclude="~vendor~" - name: Check PHP Version run: php -v - name: Check Composer Version @@ -124,7 +121,7 @@ jobs: # Test - name: Run tests suite with coverage if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage - run: php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml + run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml env: DB_CONNECTION: ${{ matrix.connection }} - name: Run tests