Cache node_modules between workflows (https://github.com/woocommerce/woocommerce-blocks/pull/6404)
* Running actions * Cache node_modules * Correct cache-name-prop * rejig if statements * cache node_modules everywhere * Simplify unit test action * Add checkout action back into other unit test action steps * Share node_modules and build assets between jobs * Cache node_modules between jobs * Fix github error * Tidy up * Change wp-env-with-gutenberg to support multiple plugins * Fix permissions issue * Remove chmod * Pass woocommerce.zip as a string * Revert change to plugins override in unit test workflow * Revert wp-env-with-gutenberg change * Revert wp-env-with-gutenberg change * Revert wp-env-with-gutenberg change * Refactor check-modified-assets workflow * Fix missed dependency * Revert breaking the check-modified-assets.yml
This commit is contained in:
parent
4a7b8ae1cf
commit
52a87760c3
|
@ -10,15 +10,28 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: trunk
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
npm run build:check-assets
|
||||
|
||||
- name: Install Node dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
@ -30,15 +43,25 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: npm install
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
npm run build:check-assets
|
||||
|
||||
- name: Build Assets
|
||||
run: npm run build:check-assets
|
||||
|
||||
- name: Download assets (trunk)
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
|
|
|
@ -13,12 +13,24 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Install Node dependencies
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
JSLintingCheck:
|
||||
|
@ -28,13 +40,21 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup node version and npm cache
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Install Node dependencies
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Save code linting report JSON
|
||||
run: npm run lint:js:report
|
||||
# Continue to the next step even if this fails
|
||||
|
@ -57,12 +77,19 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup node version and npm cache
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Install Node dependencies
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Lint CSS
|
||||
run: npm run lint:css
|
||||
|
|
|
@ -11,15 +11,29 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
|
@ -64,15 +78,28 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
|
|
|
@ -11,20 +11,38 @@ jobs:
|
|||
name: Setup
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Install Node Dependencies
|
||||
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
||||
run: npm ci --no-optional
|
||||
|
||||
- name: Build Assets
|
||||
run: FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Store Build Assets
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
path: build/
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
|
@ -40,8 +58,7 @@ jobs:
|
|||
tools: composer
|
||||
|
||||
- name: Composer install
|
||||
run: |
|
||||
composer install
|
||||
run: composer install
|
||||
|
||||
PHPUnitTests:
|
||||
name: PHP Unit Tests
|
||||
|
@ -50,23 +67,38 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Npm install #build is not needed
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
|
||||
- name: Download Build Assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo 'woocommerce_blocks_phase = 3' > blocks.ini
|
||||
run: echo 'woocommerce_blocks_phase = 3' > blocks.ini
|
||||
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
chmod -R 767 ./ #TODO: Might get implemented in wp-env
|
||||
npm run wp-env start
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
run: npm run test:php
|
||||
|
||||
- name: Run PHPUnit tests (WooCommerce Development Version)
|
||||
run: |
|
||||
JSON='{"plugins": [".","https://downloads.wordpress.org/plugin/woocommerce.zip"]}'
|
||||
|
@ -78,23 +110,31 @@ jobs:
|
|||
name: JS Unit Tests
|
||||
needs: Setup
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node_modules
|
||||
id: cache-node-modules
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup node version and npm cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Npm install and build
|
||||
run: |
|
||||
npm ci --no-optional
|
||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||
|
||||
- name: Download Build Assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: blocks.ini setup
|
||||
run: |
|
||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||
|
||||
- name: Run JavaScript Unit tests
|
||||
run: |
|
||||
npm run test
|
||||
run: npm run test
|
||||
|
|
Loading…
Reference in New Issue