-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (109 loc) · 3.89 KB
/
ci.yml
File metadata and controls
142 lines (109 loc) · 3.89 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Example of a CI workflow
name: MATLAB Build
# Controls when the action will run.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
PRODUCT_LIST: MATLAB MATLAB_Test SimBiology Statistics_and_Machine_Learning_Toolbox MATLAB_Compiler
MLM_LICENSE_TOKEN: ${{secrets.MLM_LICENSE_TOKEN}}
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Avoid the test job to be run before and after auto-merging of dev branch if not up-to-date
concurrency:
group: "test"
cancel-in-progress: true
jobs:
test:
name: Test dev branch
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
# Check out your repository
- uses: actions/checkout@v5
# Start display server (for UI tests in Linux)
- name: Start display server
run: |
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
# Set up MATLAB on a GitHub-hosted runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v3
with:
products: ${{ env.PRODUCT_LIST }}
cache: true
# Run the MATLAB build tool to build and test your code
- name: Run buildtool
uses: matlab-actions/run-build@v3
with:
tasks: test
build:
name: Deploy/Release (main)
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main' ) }}
# Set up URLs for GitHub Pages report
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check out your repository
- uses: actions/checkout@v5
# Start display server (for UI tests in Linux)
- name: Start display server
run: |
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
# Set up MATLAB on a GitHub-hosted runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v3
with:
products: ${{ env.PRODUCT_LIST }}
cache: true
# Run the MATLAB build tool to build and test your code
- name: Run buildtool
uses: matlab-actions/run-build@v3
with:
tasks: test # change to compile
# Configure GitHub Pages to accept your artifact uploads
- name: Setup Pages
if: always()
uses: actions/configure-pages@v6
# Upload testing and code coverage reports to your repository
- name: Upload pages
if: always()
uses: actions/upload-pages-artifact@v4
with:
path: results # Upload results
# # Upload compiled CTF file to deploy Web App
# - name: Upload CTF file
# uses: actions/upload-artifact@v6
# with:
# name: WebApp_CTF
# path: WebAppArchive/*.ctf
# Publish reports to GitHub Pages so they can be viewed in a browser
- name: Deploy to GitHub Pages
id: deployment
if: always()
uses: actions/deploy-pages@v5
# ==================================== #
# Alternate ways to run commands in CI #
# ==================================== #
## Runs your tests using `runtests` command
#- name: Run all tests
# uses: matlab-actions/run-tests@v3
# with:
# source-folder: code
## Executes custom MATLAB scripts, functions, or statements
#- name: Run custom testing procedure
# uses: matlab-actions/run-command@v3
# with:
# command: disp('Running my custom testing procedure!'); addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);