-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.29 KB
/
test-action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Job name
name: Application testing
# When the to run the greeting
on: [pull_request]
# Jobs to run for the action (You can have multiple actions in one file)
jobs:
test:
# Job display name
name: Running React-Testing-Library and Jest tests
# Runs on a Linux based OS
runs-on: ubuntu-latest
# Steps involved for this particular task
steps:
# Checks out the repository and enables the use of commands made available in the project ie npm run
- name: Checkout Git repository
uses: actions/checkout@v2
# Configure yarn
- name: Setup Node.js version
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
# Cache the node_modules, only invalidate when the yarn lock file changes
# Original source: https://dev.to/mpocock1/how-to-cache-nodemodules-in-github-actions-with-yarn-24eh
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
# Installs all the project dependencies e.g. prettier, eslint etc via a custom project script
- name: Install yarn dependencies
run: 'yarn install'
# Run the react-testing-library tests
- name: Run all tests
run: 'yarn client:test'