-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (101 loc) · 3.88 KB
/
parallel-server-images.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
# Copyright 2024 The MathWorks, Inc.
name: Build and push MATLAB Parallel Server images
on:
workflow_dispatch:
push:
# Trigger the workflow if image files or this workflow file are changed
branches:
- main
paths:
- "images/job-manager/**"
- "images/worker/**"
- ".github/workflows/parallel-server-images.yml"
schedule:
# Run at 00:00 on every Tuesday (2nd Day of the Week)
# This captures updates to matlab-deps, which is rebuilt every Monday
- cron: "0 0 * * 2"
env:
LICENSE_FILE_PATH: ${{ github.workspace }}/license.lic
JM_IMAGE: ghcr.io/mathworks-ref-arch/matlab-parallel-server-k8s/mjs-job-manager-image
jobs:
# Build the job manager image and push to GHCR.
build-push-job-manager-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
matlab-release: [r2024a, r2024b]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build local image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./images/job-manager
build-args: MATLAB_RELEASE=${{ matrix.matlab-release }}
tags: ${{ env.JM_IMAGE }}:${{ matrix.matlab-release }}
- name: Test MJS on container
env:
BIN_DIR: /opt/matlab/toolbox/parallel/bin
run: docker run ${JM_IMAGE}:${{ matrix.matlab-release }} bash -c "${BIN_DIR}/mjs start && ${BIN_DIR}/startjobmanager && ${BIN_DIR}/glnxa64/mjshealthcheck -matlabroot /opt/matlab"
- name: Push to GHCR
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./images/job-manager
build-args: MATLAB_RELEASE=${{ matrix.matlab-release }}
tags: ${{ env.JM_IMAGE }}:${{ matrix.matlab-release }}
push: true
# Build the worker image on top of the job manager image. This requires a large runner so we have enough storage for the local image.
build-push-worker-image:
runs-on: ubuntu-latest-m
needs: [build-push-job-manager-image]
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
matlab-release: [r2024a, r2024b]
env:
WORKER_IMAGE: ghcr.io/mathworks-ref-arch/matlab-parallel-server-k8s/mjs-worker-image
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build local image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./images/worker
build-args: MATLAB_RELEASE=${{ matrix.matlab-release }}
tags: ${{ env.WORKER_IMAGE }}:${{ matrix.matlab-release }}
- name: Generate MATLAB license file
run: echo '${{ secrets.MATLAB_LICENSE_FILE_R2024A }}' > ${{ env.LICENSE_FILE_PATH }}
- name: Test MATLAB on container
env:
MLM_LICENSE_FILE: /tmp/license.lic # License file path on container
run: docker run -v ${LICENSE_FILE_PATH}:${MLM_LICENSE_FILE} ${WORKER_IMAGE}:${{ matrix.matlab-release }} bash -c "MLM_LICENSE_FILE=${MLM_LICENSE_FILE} /opt/matlab/bin/matlab -batch 'version'"
- name: Push to GHCR
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./images/worker
tags: ${{ env.WORKER_IMAGE }}:${{ matrix.matlab-release }}
build-args: MATLAB_RELEASE=${{ matrix.matlab-release }}
push: true