-
Notifications
You must be signed in to change notification settings - Fork 10
131 lines (112 loc) · 4.54 KB
/
release.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
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
# Release Climate Data Store Toolbox across all supported releases of MATLAB, package toolbox, create release
name: MATLAB Release
# Run workflow when a tag is created
on:
push:
tags:
- 'v*'
jobs:
# This workflow contains:
# 1. a matrixed test job run across a bunch of releases of MATLAB
# 2. a reporting job that summarizes the tests, and updates release badge
# Added support for R2023b
test:
strategy:
fail-fast: false
matrix:
MATLABVersion: [R2020a, R2020b, R2021a, R2021b, R2022a, R2022b, R2023a, R2023b, R2024a]
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: ${{ matrix.MATLABVersion }}
# Runs all tests in the project. Put results in a version specific subdirectory
- name: Run tests
uses: matlab-actions/run-command@v1
with:
command: addpath("buildUtilities"),testToolbox('ReportSubdirectory',"${{ matrix.MATLABVersion }}")
# Upload code coverage information to Codecov
- name: Upload code coverage report to Codecov (https://app.codecov.io/gh/mathworks/climatedatastore)
uses: codecov/codecov-action@v3
with:
files: reports/codecoverage.xml
env_vars: ${{ matrix.MATLABVersion }}
# Save the contents of the report directory from each release into a single artifact. Since each release makes their own directory, they all update the same artifact.
- name: Save Report Directory
uses: actions/upload-artifact@v3
if: always()
with:
name: reports
path: reports
# Report on what releases tested successfully.
# Generate a draft release based on the tag
# Recreate the tag with the final version of JSON files and the ToolboxPackaging.prj
release:
needs: test
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: refs/heads/main
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
# Copy all the reports down into the container
- uses: actions/download-artifact@v3
with:
name: reports
path: reports
# Generate the JSON for the releases tested badge
- name: Generate tested with badge
uses: matlab-actions/run-command@v1
with:
command: addpath("buildUtilities"),badgesforToolbox()
# Publish test results from all the releases
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: "reports/*/test-results.xml"
# Package the MLTBX
- name: Package Toolbox
uses: matlab-actions/run-command@v1
with:
command: addpath("buildUtilities"),packageToolbox("specific","${{ github.ref_name }}")
# Save the MLTBX.
- name: Save Packaged Toolbox
uses: actions/upload-artifact@v3
with:
name: Climate_Data_Store_Toolbox_for_MATLAB.mltbx
path: release/Climate_Data_Store_Toolbox_for_MATLAB.mltbx
# Commit the JSON for the MATLAB releases badge and ToolboxPackaging.prj
- name: commit changed files
continue-on-error: true
run: |
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
git config user.email "<>"
git commit reports/badge/tested_with.json -m "Final checkins for release ${{ github.ref_name }}"
git commit ToolboxPackaging.prj -m "Final checkins for release ${{ github.ref_name }}"
git fetch
git push
# Retag the repo so that the updated files are included in the release tag
- name: update tag
if: always()
continue-on-error: true
run: |
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
git config user.email "<>"
git tag -d "${{ github.ref_name }}"
git push --delete origin ${{ github.ref_name }}
git tag -m "Release ${{ github.ref_name }}" ${{ github.ref_name }}
git push --tag
# Create the release
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
draft: true
artifacts: "release/Climate_Data_Store_Toolbox_for_MATLAB.mltbx"
generateReleaseNotes: true