name: Run code coverage on PR on: pull_request defaults: run: shell: bash concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: name: Code coverage (PHP 7.4, WP Latest) timeout-minutes: 20 runs-on: ubuntu-20.04 services: database: image: mysql:5.6 env: MYSQL_ROOT_PASSWORD: root ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 100 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: 7.4 tools: composer extensions: mysql coverage: none - name: Tool versions run: | php --version composer --version - name: Get cached composer and pnpm directories uses: actions/cache@v3 id: cache-deps with: path: | ~/.pnpm-store plugins/woocommerce/packages plugins/woocommerce/**/vendor key: ${{ runner.os }}-npm-composer-version-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }} - name: Install PNPM run: npm install -g pnpm@^6.24.2 - name: Install dependencies run: pnpm install - name: Install Composer dependencies if: steps.cache-deps.outputs.cache-hit != 'true' run: pnpm nx composer-install woocommerce - name: Build Admin feature config run: | pnpm nx build:feature-config woocommerce - name: Init DB and WP run: pnpm nx install-unit-test-db woocommerce - name: Run unit tests with code coverage. Allow to fail. run: | pnpm nx test-code-coverage woocommerce exit 0 - name: Send code coverage to Codecov. run: | bash <(curl -s https://codecov.io/bash)