-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (54 loc) · 1.52 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
platform: [intel, arm]
steps:
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v2
# Cache Node.js dependencies
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
# Install dependencies
- name: Install dependencies
run: npm install
# Matrix conditional setup for different OS/Platforms
- name: Setup Platform Details
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
if [[ "${{ matrix.platform }}" == "arm" ]]; then
sudo apt-get update
sudo apt-get install -y build-essential libxml2-dev
fi
fi
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
if [[ "${{ matrix.platform }}" == "arm" ]]; then
echo "Simulating Apple Silicon scenario"
else
echo "Simulating Intel Mac scenario"
fi
fi
# Run tests
- name: Run tests
run: npm run test