-
Notifications
You must be signed in to change notification settings - Fork 10
97 lines (81 loc) · 3.06 KB
/
build-test-and-publish-matlab.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
# Copyright 2024 The MathWorks, Inc.
# This file builds, tests & publishes the mathworks/matlab and mathworks/matlab-deep-learning Docker Images to DockerHub.
# Both images are built during a single job to optimise caching and final storage size for the images.
name: Build, Test and Publish MATLAB images
on:
workflow_dispatch:
# Runs at 02:00 every Monday
schedule:
- cron: "0 2 * * 1"
push:
branches: ["main"]
paths:
- ".github/workflows/build-test-and-publish-matlab.yml"
- ".github/actions/build-test-and-publish-matlab/action.yml"
- "matlab/*"
- "tests/matlab/*"
jobs:
test-shell-scripts:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run shell script unit tests
working-directory: tests/matlab
run: ./run-bats-test.sh
build-test-push-matlab:
needs: test-shell-scripts
strategy:
fail-fast: false
matrix:
matlab_release: [R2024b, R2024a, R2023b, R2023a]
runs-on: ubuntu-latest-m
steps:
- name: Checkout repo
uses: actions/checkout@v4
# GitHub runners come preinstalled with a lot of software that
# is not needed for this workflow. To increase available space
# these packages are removed.
# https://github.com/actions/runner-images/issues/2840
- name: Cleanup
run: |
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build, Test, and Publish MATLAB
id: build-test-and-publish-matlab-to-dockerhub
uses: ./.github/actions/build-test-and-publish-matlab
with:
variant: matlab
matlab_release: ${{ matrix.matlab_release }}
matlab_license_file: ${{ secrets.MATLAB_LICENSE_FILE_R2024B }}
base_image_name: "mathworks/matlab"
- name: Build, Test, and Publish MATLAB Deep Learning
# Run this step even if the previous step failed
if: success() || steps.build-test-and-publish-matlab-to-dockerhub.outcome == 'failure'
uses: ./.github/actions/build-test-and-publish-matlab
with:
variant: matlab-deep-learning
matlab_release: ${{ matrix.matlab_release }}
matlab_license_file: ${{ secrets.MATLAB_LICENSE_FILE_R2024B }}
base_image_name: "mathworks/matlab-deep-learning"
- name: Fail job if any tests failed
if: steps.build-test-and-publish-matlab-to-dockerhub.outcome == 'failure'
run: exit 1