Skip to content

Commit 8ad31a7

Browse files
committed
Add GitHub CI
1 parent c4e8add commit 8ad31a7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: MATLAB Build
2+
3+
# Controls when the action will run.
4+
on:
5+
push:
6+
branches: [ release ]
7+
pull_request:
8+
branches: [ release ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
test:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
MATLABVersion: [R2021b,R2023a,R2023b]
17+
runs-on: ubuntu-latest
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v3
21+
22+
# Sets up MATLAB on the GitHub Actions runner
23+
- name: Setup MATLAB
24+
uses: matlab-actions/setup-matlab@v1
25+
with:
26+
release: ${{ matrix.MATLABVersion }}
27+
28+
# Run SmokeTests
29+
- name: Run SmokeTests
30+
uses: matlab-actions/run-command@v1
31+
with:
32+
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","SmokeTests.m")); assertSuccess(results);
33+
34+
# Run FunctionTests
35+
- name: Run FunctionTests
36+
uses: matlab-actions/run-command@v1
37+
with:
38+
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","FunctionTests.m")); assertSuccess(results);
39+
40+
# Upload the test results as artifact
41+
- name: Upload TestResults
42+
uses: actions/upload-artifact@v3.1.3
43+
with:
44+
name: TestResults
45+
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt
46+
47+
# Download the test results from artifact
48+
- name: Download TestResults
49+
uses: actions/download-artifact@v2.1.1
50+
with:
51+
name: TestResults
52+
path: ./SoftwareTests/
53+
54+
# Create the test results badge
55+
- name: Run CreateBadge
56+
uses: matlab-actions/run-command@v1
57+
with:
58+
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","CreateBadge.m"));
59+
60+
# Commit the JSON for the MATLAB releases badge
61+
- name: Commit changed files
62+
continue-on-error: true
63+
run: |
64+
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
65+
git config user.email "<>"
66+
git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}"
67+
git fetch
68+
git push

0 commit comments

Comments
 (0)