-
Notifications
You must be signed in to change notification settings - Fork 11
79 lines (65 loc) · 2.25 KB
/
build-test-and-publish-network-licensing-manager.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
# Copyright 2024 The MathWorks, Inc.
name: Build, Test and Publish the Network License Manager Container
# Trigger this workflow either manually or when a new change is pushed to the
# repo (except .md files)
on:
workflow_dispatch:
# Run workflow when there is a push to the 'main' branch & push includes changes to any files in described path
push:
branches:
- 'main'
paths:
- 'network-license-manager/**'
schedule:
# Run at 00:00 on every Monday (1st Day of the Week)
- cron: "0 0 * * 1"
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/network-license-manager
LICENSE_FILE_PATH: ${{ github.workspace }}/licenses/license.dat
HOSTNAME: docker-server
MAC_ADDRESS: ${{ secrets.NLM_CONTAINER_TEST_MAC_ADDRESS }}
PORT: 27012
MATLAB_RELEASE: latest
jobs:
build-test-push-image:
runs-on: ubuntu-latest
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.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image locally
uses: docker/build-push-action@v5
with:
context: ./network-license-manager
platforms: linux/amd64
load: true
tags: |
${{ env.IMAGE_NAME }}:latest
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install test dependencies
working-directory: ./network-license-manager/tests
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Generate license file
env:
MATLAB_LICENSE_FILE: ${{ secrets.MATLAB_LICENSE_FILE_R2024B }}
working-directory: ./network-license-manager/tests
run: ./setup_gen_licfile.sh
- name: Test container
env:
IMAGE_NAME: ${{ env.IMAGE_NAME }}:latest
working-directory: ./network-license-manager/tests
run: python -m unittest
- name: Push the image to ghcr.io
run: docker push ${{ env.IMAGE_NAME }}:latest