-
Notifications
You must be signed in to change notification settings - Fork 4
153 lines (132 loc) · 4.9 KB
/
Copy pathmatlabact.yml
File metadata and controls
153 lines (132 loc) · 4.9 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
143
144
145
146
147
148
149
150
151
152
name: Run MATLAB Build on GitHub-Hosted Runner
on:
push:
branches: [main]
env:
MLM_LICENSE_TOKEN: ${{ secrets.LICTOKEN }}
# SonarQube connection details
#SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
jobs:
check_test:
name: Run MATLAB Build & Test
strategy:
matrix:
os: [ubuntu-latest]
release: [latest-including-prerelease]
runs-on: ${{ matrix.os }}
#runs-on: self-hosted
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler MATLAB_Test
cache: true
release: ${{ matrix.release }}
- name: Run build to check code and run unit tests
uses: matlab-actions/run-build@v2
with:
tasks: check test coverage
- name: Run MATLAB Tests and Generate Coverage
uses: matlab-actions/run-tests@v2
with:
source-folder: source
# Output location for JUnit-style test results
test-results-junit: test-results/results.xml
# Output location for Cobertura coverage report
code-coverage-cobertura: code-coverage/coverage.xml
- name: Upload Test Results Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: matlab-test-results
path: test-results/results.xml
- name: Upload Coverage Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: matlab-coverage-report
path: code-coverage/coverage.xml
- name: Upload Cobertura Coverage Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: matlab-cobertura-coverage-report
path: coverageReport.xml
- name: Debug Coverage File
run: cat code-coverage/coverage.xml
- name: Annotate coverage
uses: 5monkeys/cobertura-action@v13
with:
path: coverageReport.xml
minimum_coverage: 60
# - name: SonarCloud Scan
# uses: SonarSource/sonarqube-scan-action@v5
# with:
# # projectBaseDir: .
# args: >
# -Dsonar.organization=mw-jsgeorge
# -Dsonar.projectKey=mw-jsgeorge-TimesTableApp
# -Dsonar.language=text
# -Dsonar.sources=source
# -Dsonar.inclusions=**/*.m
# -Dsonar.coverage.jacoco.xmlReportPaths=""
# -Dsonar.coverage.cobertura.reportPaths=code-coverage/coverage.xml
# -Dsonar.c.file.suffixes=-
# -Dsonar.cpp.file.suffixes=-
# -Dsonar.objc.file.suffixes=-
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Check Java version
# run: java -version
# - name: Add JAVA_HOME to PATH
# run: echo "${JAVA_HOME}/bin" >> $GITHUB_PATH
# - name: Download SonarScanner CLI
# run: |
# # Download and unzip SonarScanner CLI (example for Linux runner)
# wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip -O sonar-scanner.zip
# unzip sonar-scanner.zip
# mv sonar-scanner-4.8.0.2856-linux sonar-scanner
# echo "$(pwd)/sonar-scanner/bin" >> $GITHUB_PATH
# - name: Run SonarScanner CLI to upload coverage
# run: |
# java -version # Confirm Java 17 is in use
# sonar-scanner \
# -Dsonar.projectKey=mw-jsgeorge-TimesTableApp \
# -Dsonar.sources=source \
# -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
# -Dsonar.login=${{ secrets.SONAR_TOKEN }} \
# -Dsonar.coverage.cobertura.reportPaths=code-coverage/coverage.xml
# deploy:
# # This job executes only after a successful completion of 'mex-and-unittests' job
# needs: check_test
# name: Generate Deploy Artifacts
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - name: Check out repository
# uses: actions/checkout@v4
# - name: Install MATLAB
# uses: matlab-actions/setup-matlab@v2
# with:
# products: MATLAB_Compiler
# release: R2024a
# - name: Run build
# uses: matlab-actions/run-build@v2
# with:
# tasks: pcode deploy
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: app-${{ matrix.os }}
# path: ./*standalone*/*timestable*