Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Trim down unit test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jan 19, 2023
1 parent 88ea2d2 commit 95991e9
Showing 1 changed file with 4 additions and 73 deletions.
77 changes: 4 additions & 73 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Unit Tests

# Since Unit Tests are required to pass for each PR,
# we cannot disable them for documentation-only changes.
on:
pull_request:
push:
branches:
- trunk
- 'release/**'
- 'wp/**'
- 'main*'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
Expand All @@ -18,94 +14,29 @@ concurrency:
cancel-in-progress: true

jobs:
unit-js:
name: JavaScript
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}

strategy:
fail-fast: false
matrix:
node: ['14']

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ matrix.node }}
cache: npm

- name: Npm install and build
# It's not necessary to run the full build, since Jest can interpret
# source files with `babel-jest`. Some packages have their own custom
# build tasks, however. These must be run.
run: |
npm ci
npx lerna run build
- name: Running the tests
run: npm run test:unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"

- name: Running the date tests
run: npm run test:unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"

unit-php:
name: PHP
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
if: ${{ github.repository == 'WordPress/block-hydration-experiments' || github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
node-version: 14
cache: npm

- name: Npm install and build
run: |
npm ci
npm run build
- name: Install WordPress
- name: Run WordPress
run: |
npm run wp-env start
- name: Running lint check
run: npm run lint:php

- name: Running single site unit tests
run: npm run test:unit:php
if: ${{ success() || failure() }}

- name: Running multisite unit tests
run: npm run test:unit:php:multisite
if: ${{ success() || failure() }}

mobile-unit-js:
name: Mobile
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
# It's not necessary to run the full build, since Jest can interpret
# source files with `babel-jest`. Some packages have their own custom
# build tasks, however. These must be run.
run: |
npm ci
npx lerna run build
- name: Running the tests
run: npm run native test -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"

0 comments on commit 95991e9

Please sign in to comment.