Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit aa0e7b3

Browse files
authored
Split unit tests up from e2e tests (#3989)
1 parent 21dfafd commit aa0e7b3

File tree

2 files changed

+139
-81
lines changed

2 files changed

+139
-81
lines changed

.github/workflows/php-js-e2e-tests.yml

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Automated tests
1+
name: E2E tests
22

33
on:
44
push:
@@ -58,86 +58,6 @@ jobs:
5858
run: |
5959
composer install
6060
61-
PHPUnitTests:
62-
name: PHP Unit Tests
63-
needs: Setup
64-
65-
runs-on: ubuntu-latest
66-
67-
steps:
68-
- uses: actions/checkout@v2
69-
70-
- name: Get Composer Cache Directory
71-
id: composer-cache
72-
run: |
73-
echo "::set-output name=dir::$(composer config cache-files-dir)"
74-
- uses: actions/cache@v2
75-
with:
76-
path: ${{ steps.composer-cache.outputs.dir }}
77-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
78-
restore-keys: |
79-
${{ runner.os }}-composer-
80-
81-
- name: Set up PHP
82-
uses: shivammathur/setup-php@v2
83-
with:
84-
php-version: 7.4
85-
coverage: none
86-
tools: composer
87-
88-
- name: Composer install
89-
run: |
90-
composer install
91-
92-
- name: blocks.ini setup
93-
run: |
94-
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
95-
96-
- name: Run PHP Unit tests
97-
run: |
98-
npm run phpunit
99-
100-
JSUnitTests:
101-
name: JS Unit Tests
102-
needs: Setup
103-
104-
runs-on: ubuntu-latest
105-
106-
steps:
107-
- uses: actions/checkout@v2
108-
109-
- name: Cache node modules
110-
uses: actions/cache@v2
111-
env:
112-
cache-name: cache-node-modules
113-
with:
114-
# npm cache files are stored in `~/.npm` on Linux/macOS
115-
path: ~/.npm
116-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
117-
restore-keys: |
118-
${{ runner.os }}-build-${{ env.cache-name }}-
119-
${{ runner.os }}-build-
120-
${{ runner.os }}-
121-
122-
- name: Use Node.js 14.x
123-
uses: actions/setup-node@v1
124-
with:
125-
node-version: 14.x
126-
127-
- name: Npm install and build
128-
run: |
129-
npm ci
130-
FORCE_REDUCED_MOTION=true npm run build:e2e-test
131-
132-
- name: blocks.ini setup
133-
run: |
134-
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
135-
136-
- name: Run JavaScript Unit tests
137-
run: |
138-
npm run test
139-
140-
14161
JSE2ETestsWP57Gutenberg:
14262
name: JavaScipt E2E Tests (WP 5.7 with Gutenberg plugin)
14363
needs: Setup

.github/workflows/unit-tests.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Unit tests
2+
3+
on:
4+
push:
5+
branches: [trunk]
6+
pull_request:
7+
8+
jobs:
9+
10+
Setup:
11+
runs-on: ubuntu-latest
12+
name: Setup
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Cache node modules
17+
uses: actions/cache@v2
18+
env:
19+
cache-name: cache-node-modules
20+
with:
21+
# npm cache files are stored in `~/.npm` on Linux/macOS
22+
path: ~/.npm
23+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-build-${{ env.cache-name }}-
26+
${{ runner.os }}-build-
27+
${{ runner.os }}-
28+
29+
- name: Use Node.js 14.x
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: 14.x
33+
34+
- name: Npm install and build
35+
run: |
36+
npm ci
37+
FORCE_REDUCED_MOTION=true npm run build:e2e-test
38+
39+
- name: Get Composer Cache Directory
40+
id: composer-cache
41+
run: |
42+
echo "::set-output name=dir::$(composer config cache-files-dir)"
43+
- uses: actions/cache@v2
44+
with:
45+
path: ${{ steps.composer-cache.outputs.dir }}
46+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-composer-
49+
50+
- name: Set up PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: 7.4
54+
coverage: none
55+
tools: composer
56+
57+
- name: Composer install
58+
run: |
59+
composer install
60+
61+
PHPUnitTests:
62+
name: PHP Unit Tests
63+
needs: Setup
64+
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@v2
69+
70+
- name: Get Composer Cache Directory
71+
id: composer-cache
72+
run: |
73+
echo "::set-output name=dir::$(composer config cache-files-dir)"
74+
- uses: actions/cache@v2
75+
with:
76+
path: ${{ steps.composer-cache.outputs.dir }}
77+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-composer-
80+
81+
- name: Set up PHP
82+
uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: 7.4
85+
coverage: none
86+
tools: composer
87+
88+
- name: Composer install
89+
run: |
90+
composer install
91+
92+
- name: blocks.ini setup
93+
run: |
94+
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
95+
96+
- name: Run PHP Unit tests
97+
run: |
98+
npm run phpunit
99+
100+
JSUnitTests:
101+
name: JS Unit Tests
102+
needs: Setup
103+
104+
runs-on: ubuntu-latest
105+
106+
steps:
107+
- uses: actions/checkout@v2
108+
109+
- name: Cache node modules
110+
uses: actions/cache@v2
111+
env:
112+
cache-name: cache-node-modules
113+
with:
114+
# npm cache files are stored in `~/.npm` on Linux/macOS
115+
path: ~/.npm
116+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
117+
restore-keys: |
118+
${{ runner.os }}-build-${{ env.cache-name }}-
119+
${{ runner.os }}-build-
120+
${{ runner.os }}-
121+
122+
- name: Use Node.js 14.x
123+
uses: actions/setup-node@v1
124+
with:
125+
node-version: 14.x
126+
127+
- name: Npm install and build
128+
run: |
129+
npm ci
130+
FORCE_REDUCED_MOTION=true npm run build:e2e-test
131+
132+
- name: blocks.ini setup
133+
run: |
134+
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
135+
136+
- name: Run JavaScript Unit tests
137+
run: |
138+
npm run test

0 commit comments

Comments
 (0)