diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1984d676f..76789c671 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ on: pull_request: - paths: + paths: &paths - 'src/**' - 'tests/**' - '.github/workflows/build.yml' @@ -9,28 +9,20 @@ on: push: branches: ['master'] - paths: - - 'src/**' - - 'tests/**' - - '.github/workflows/build.yml' - - 'composer.json' - - 'phpunit.xml.dist' + paths: *paths name: build +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: tests: - name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }} - - env: - COMPOSER_ROOT_VERSION: 1.0.0 - EXTENSIONS: pdo, pdo_pgsql - - runs-on: ubuntu-latest + name: Postgres ${{ matrix.pgsql }} strategy: matrix: @@ -51,52 +43,17 @@ jobs: include: - php: 8.1 - pgsql: 17 + pgsql: 18 - php: 8.2 - pgsql: 17 + pgsql: 18 - php: 8.3 - pgsql: 17 + pgsql: 18 - php: 8.4 - pgsql: 17 - - services: - postgres: - image: postgres:${{ matrix.pgsql }} - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: root - POSTGRES_DB: yiitest - ports: - - 5432:5432 - options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 - - steps: - - name: Checkout. - uses: actions/checkout@v4 - - - name: Install PHP with extensions. - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.EXTENSIONS }} - ini-values: date.timezone='UTC' - coverage: pcov - - - name: Update composer. - run: composer self-update - - - name: Install db. - uses: yiisoft/actions/install-packages@master - with: - packages: >- - ['db'] - - - name: Run tests with phpunit with code coverage. - run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always --display-warnings --display-deprecations - - - name: Upload coverage to Codecov. - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - + pgsql: 18 + + uses: yiisoft/actions/.github/workflows/db-pgsql.yml@master + with: + pgsql: ${{ matrix.pgsql }} + php: >- + [${{ matrix.php }}] + codecov-php: ${{ matrix.php }}