From 6f0bba9e23c951ae7487ede7a7e347d2ce38a783 Mon Sep 17 00:00:00 2001 From: roykho Date: Tue, 16 Nov 2021 07:26:33 -0800 Subject: [PATCH] Use Nx commands in pr-code-coverage action --- .github/workflows/pr-code-coverage.yml | 14 +++++++++++--- plugins/woocommerce/project.json | 12 ++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-code-coverage.yml b/.github/workflows/pr-code-coverage.yml index 18f437a2dab..35c5a712916 100644 --- a/.github/workflows/pr-code-coverage.yml +++ b/.github/workflows/pr-code-coverage.yml @@ -45,15 +45,23 @@ jobs: ./vendor key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }} + - name: Install PNPM and install dependencies + run: | + npm install -g pnpm + pnpm install + + - name: Install Nx + run: npm install -g nx + - name: Setup and install composer - run: composer install + run: pnpm nx composer-install woocommerce - name: Init DB and WP - run: ./tests/bin/install.sh woo_test root root 127.0.0.1 latest + run: pnpm nx install-unit-test-db woocommerce - name: Run unit tests with code coverage. Allow to fail. run: | - RUN_CODE_COVERAGE=1 bash ./tests/bin/phpunit.sh + pnpm nx test-code-coverage woocommerce exit 0 - name: Send code coverage to Codecov. diff --git a/plugins/woocommerce/project.json b/plugins/woocommerce/project.json index daceebe9e15..6d64ab38f92 100644 --- a/plugins/woocommerce/project.json +++ b/plugins/woocommerce/project.json @@ -122,6 +122,18 @@ "options": { "script": "make:collection" } + }, + "install-unit-test-db": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "command": "bash ./tests/bin/install.sh woo_test root root 127.0.0.1 latest" + } + }, + "test-code-coverage": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "command": "RUN_CODE_COVERAGE=1 bash ./tests/bin/phpunit.sh" + } } } }