Skip to content

Commit 717f791

Browse files
committed
Add Github workflow for running unit tests
1 parent 2de8af5 commit 717f791

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/unit-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
# Cancels all previous workflow runs for pull requests that have not completed.
10+
concurrency:
11+
# The concurrency group contains the workflow name and the branch name for pull requests
12+
# or the commit hash for any other events.
13+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
unit-php:
18+
name: PHP
19+
runs-on: ubuntu-latest
20+
if: ${{ github.repository == 'BeAPI/multisite-shared-blocks' || github.event_name == 'pull_request' }}
21+
22+
steps:
23+
- name: Checkout project
24+
uses: actions/checkout@v3
25+
26+
- name: Setup NodeJS
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version-file: '.nvmrc'
30+
cache: npm
31+
32+
- name: Npm install and build
33+
run: |
34+
npm ci
35+
npm run build
36+
37+
- name: Install WordPress
38+
run: |
39+
npm run env:start
40+
41+
- name: Run unit tests
42+
run: npm run test:php
43+
if: ${{ success() || failure() }}

0 commit comments

Comments
 (0)