-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
111 lines (101 loc) · 3.78 KB
/
action.yml
File metadata and controls
111 lines (101 loc) · 3.78 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: 'Node CI'
description: 'Simple opinionated node CI pipeline'
author: 'Andre Hildinger'
inputs:
node-version:
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
required: true
cache:
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
default: 'npm'
cache-dependency-path:
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
install-command:
description: 'The command that will be executed to install the dependencies.'
default: 'npm ci'
enable-codeql:
description: 'Enabled CodeQL to run. You might want to set this to false if running on a private repo.'
default: true
lint-command:
description: 'The command that will be executed to lint on the project.'
default: 'npm run lint'
build-command:
description: 'The command that will be executed to build the project.'
default: 'npm run build'
test-command:
description: 'The command that will be executed to run unit tests.'
default: 'npm test'
start-command:
description: 'The command that will be executed to start the application.'
default: 'npm start'
integration-test-lib:
description: 'The library used to run integration tests. Accepts "playwright", "cypress", or "custom" for custom tests.'
default: 'playwright'
integration-test-command:
description: 'The command that will be executed to run integration tests.'
default: 'npm run test:pw'
integration-test-report-path:
description: 'The integration tests report path.'
default: 'playwright-report/'
runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.cache }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
- name: Install dependencies
shell: bash
run: ${{ inputs.install-command }}
- name: Initialize CodeQL
if: ${{ inputs.enable-codeql == 'true' }}
uses: github/codeql-action/init@v3
with:
languages: 'javascript'
- name: Perform CodeQL Analysis
if: ${{ inputs.enable-codeql == 'true' }}
uses: github/codeql-action/analyze@v3
- name: Lint
shell: bash
run: ${{ inputs.lint-command }}
- name: Build
shell: bash
run: ${{ inputs.build-command }}
- name: Run Unit Tests
shell: bash
run: ${{ inputs.test-command }}
# Playwright
- name: Install Playwright Browsers
if: ${{ inputs.integration-test-lib == 'playwright' }}
shell: bash
run: npx playwright install --with-deps
- name: Run Playwright tests
if: ${{ inputs.integration-test-lib == 'playwright' }}
shell: bash
run: ${{ inputs.start-command }} & ${{ inputs.integration-test-command }}
# Cypress
- name: Install Chrome
if: ${{ inputs.integration-test-lib == 'cypress' }}
uses: browser-actions/setup-chrome@v1
- name: Install Firefox
if: ${{ inputs.integration-test-lib == 'cypress' }}
uses: browser-actions/setup-firefox@v1
- name: Install Edge
if: ${{ inputs.integration-test-lib == 'cypress' }}
uses: browser-actions/setup-edge@v1
- name: Run Cypress tests
if: ${{ inputs.integration-test-lib == 'cypress' }}
shell: bash
run: ${{ inputs.start-command }} & ${{ inputs.integration-test-command }}
# Custom
- name: Run custom integration tests
if: ${{ inputs.integration-test-lib == 'custom' }}
shell: bash
run: ${{ inputs.start-command }} & ${{ inputs.integration-test-command }}
- uses: actions/upload-artifact@v4
with:
name: integration-tests-report
path: ${{ inputs.integration-test-report-path }}
retention-days: 30