-
Notifications
You must be signed in to change notification settings - Fork 85
98 lines (83 loc) · 2.73 KB
/
template-main.yaml
File metadata and controls
98 lines (83 loc) · 2.73 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
name: 📄 Main CI - template
on:
workflow_call:
inputs:
version:
required: true
type: string
nodejs:
required: false
default: "lts/*"
type: string
code_type:
required: false
default: "stable"
type: string
jobs:
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
env:
CODE_TYPE: ${{ inputs.code_type }}
CODE_VERSION: ${{ inputs.version }}
TEST_RESOURCES: test-resources
steps:
- name: 👷🏻 Checkout Repository
uses: actions/checkout@v6
- name: ⚙️ Setup NodeJS
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.nodejs }}
cache: npm
- name: 🔧 Install
run: npm ci
- name: 🔧 Build
run: npm run build
- name: ✨ Code Formatter - Prettier
run: npx prettier . --check
- name: 🔧 Install - Test Project
run: npm install --workspace=extester-test
- name: 🔍 Run Tests (macOS)
uses: nick-fields/retry@v4
if: ${{ startsWith(matrix.os, 'mac') }}
with:
timeout_minutes: 20
retry_wait_seconds: 60
max_attempts: 3
command: npm test
on_retry_command: rm -rf "${RUNNER_TEMP}/extest-code"
- name: 🔍 Run Tests (windows)
uses: nick-fields/retry@v4
if: ${{ startsWith(matrix.os, 'win') }}
with:
timeout_minutes: 20
retry_wait_seconds: 30
max_attempts: 3
command: npm test
- name: ⚙️ Allow unprivileged user namespace (ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: 🔍 Run Tests (linux)
uses: nick-fields/retry@v4
if: ${{ startsWith(matrix.os, 'ubuntu') }}
with:
timeout_minutes: 20
retry_wait_seconds: 30
max_attempts: 3
command: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test
- name: 💾 Upload Screenshots
uses: actions/upload-artifact@v7
if: failure() && inputs.nodejs != 'lts/*'
with:
name: screenshots-${{ matrix.os }}-${{ inputs.version }}-node_${{ inputs.nodejs }}
path: ${{ github.workspace }}/tests/**/screenshots/**/*.png
- name: 💾 Upload Screenshots
uses: actions/upload-artifact@v7
if: failure() && inputs.nodejs == 'lts/*'
with:
name: screenshots-${{ matrix.os }}-${{ inputs.version }}-node_lts
path: ${{ github.workspace }}/tests/**/screenshots/**/*.png