Skip to content

Commit 52f9b3c

Browse files
authored
adjusted test.yml to modularize
1 parent 1f4ae88 commit 52f9b3c

File tree

1 file changed

+69
-23
lines changed

1 file changed

+69
-23
lines changed

.github/workflows/test.yml

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,54 @@
1-
# Run Extension tests
1+
# Build and Test MATLAB VSCode Extension
22

3-
name: test
3+
name: Build & Test
44

5-
# Controls when the workflow will run
65
on:
7-
# Triggers the workflow on push events for the "main" branch
86
push:
97
branches: [ main ]
10-
11-
# Allows you to run this workflow manually from the Actions tab
128
workflow_dispatch:
139

1410
jobs:
11+
build:
12+
name: Build VSIX (${{ matrix.os }})
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [windows-latest, ubuntu-latest, macos-13]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 18.x
27+
28+
- name: Clean install dependencies
29+
run: npm ci
30+
31+
- name: Package vsix
32+
run: npm run package
33+
34+
- name: Install npm dependencies
35+
run: npm install
36+
37+
- name: Setup tests
38+
run: npm run test-setup
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v4
42+
if: always()
43+
with:
44+
name: build-${{ matrix.os }}
45+
path: |
46+
*.vsix
47+
out
48+
1549
test-smoke:
16-
name: ${{ matrix.version }}-${{ matrix.os }}
50+
name: Test ${{ matrix.version }}-${{ matrix.os }}
51+
needs: build
1752
runs-on: ${{ matrix.os }}
1853
strategy:
1954
fail-fast: false
@@ -25,41 +60,52 @@ jobs:
2560
uses: actions/checkout@v4
2661
with:
2762
submodules: recursive
63+
64+
- name: Download build artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: build-${{ matrix.os }}
68+
2869
- name: Set up MATLAB
2970
uses: matlab-actions/setup-matlab@v2
3071
with:
3172
release: ${{ matrix.version }}
32-
- name: Setup node
73+
74+
- name: Setup Node.js
3375
uses: actions/setup-node@v4
3476
with:
35-
"node-version": 18.x
36-
- name: npm clean install
77+
node-version: 18.x
78+
79+
- name: Clean install dependencies
3780
run: npm ci
38-
- name: Start Xvfb
39-
run: /usr/bin/Xvfb :17 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
81+
82+
- name: Start Xvfb
83+
if: ${{ matrix.os == 'ubuntu-latest' }}
84+
run: |
85+
/usr/bin/Xvfb :17 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
4086
shell: bash
41-
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
42-
- name: Package vsix
43-
run: npm run package
44-
- name: npm install
87+
88+
- name: Install npm dependencies
4589
run: npm install
90+
4691
- name: Run UI tests
4792
run: npm run test-ui
93+
if: ${{ matrix.os != 'ubuntu-latest' }}
4894
env:
4995
MLM_WEB_LICENSE: true
50-
MLM_WEB_ID: ${{secrets.MLM_WEB_ID}}
51-
MLM_WEB_USER_CRED: ${{secrets.MLM_WEB_USER_CRED}}
96+
MLM_WEB_ID: ${{ secrets.MLM_WEB_ID }}
97+
MLM_WEB_USER_CRED: ${{ secrets.MLM_WEB_USER_CRED }}
5298
DISPLAY: ":17.0"
53-
if: ${{ success() && matrix.os != 'ubuntu-latest' }}
99+
54100
- name: Run Smoke tests
55101
run: npm run test-smoke
56102
env:
57103
MLM_WEB_LICENSE: true
58-
MLM_WEB_ID: ${{secrets.MLM_WEB_ID}}
59-
MLM_WEB_USER_CRED: ${{secrets.MLM_WEB_USER_CRED}}
104+
MLM_WEB_ID: ${{ secrets.MLM_WEB_ID }}
105+
MLM_WEB_USER_CRED: ${{ secrets.MLM_WEB_USER_CRED }}
60106
DISPLAY: ":17.0"
61-
62-
- name: Upload Screenshots
107+
108+
- name: Upload Screenshots
63109
uses: actions/upload-artifact@v4
64110
if: always()
65111
with:

0 commit comments

Comments
 (0)