Skip to content

Update JS libraries #2276

Update JS libraries

Update JS libraries #2276

name: JavaScript Tests
on: [push, pull_request]
jobs:
# Runs the QUnit tests for WordPress.
#
# Performs the following steps:
# - Cancels all previous workflow runs for pull requests that have not completed.
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 12
# - Sets up caching for NPM.
# - Logs updated debug information.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress QUnit tests.
test-js:
name: JavaScript Test
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node JS
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Log debug information
run: |
node --version
yarn --version
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: yarn install
- name: Run Jest tests
run: yarn test:js:coverage
- name: Code Coverage
run: |
bash <(curl -s https://codecov.io/bash);