Skip to content

Fixes failing tests for the alternates/building-on-matlab-docker-image. #9

Fixes failing tests for the alternates/building-on-matlab-docker-image.

Fixes failing tests for the alternates/building-on-matlab-docker-image. #9

# Copyright 2024 The MathWorks, Inc.
name: Build and Test the "MATLAB Container Offline Install" Dockerfiles
# Trigger this workflow either manually or when a new change is pushed to the
# repo (except .md files)
on:
workflow_dispatch:
push:
# Trigger the workflow when the Dockerfile or any file under tests/ is modified
paths:
- "alternates/matlab-container-offline-install/archive.Dockerfile"
- "alternates/matlab-container-offline-install/Dockerfile"
- "tests/alternates/matlab-container-offline-install/*"
- "tests/utils/**"
- ".github/workflows/matlab-container-offline-install-build-test.yml"
- "!**.md"
schedule:
# Run at 00:00 on every Monday (1st Day of the Week)
- cron: "0 0 * * 1"
env:
ARCHIVE_BASE_NAME: mpm-archive
IMAGE_BASE_NAME: matlab
ALT_PATH: alternates/matlab-container-offline-install
MATLAB_PRODUCT_LIST: "MATLAB Symbolic_Math_Toolbox Deep_Learning_Toolbox_Model_for_ResNet-50_Network"
LICENSE_FILE_PATH: ${{ github.workspace }}/license.lic
jobs:
build-test-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
matlab-release: [R2024a, R2023b, R2023a, R2022b, R2022a, R2021b, R2021a, R2020b]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build archive image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ${{ env.ALT_PATH }}
file: ${{ env.ALT_PATH }}/archive.Dockerfile
load: true
build-args: |
MATLAB_RELEASE=${{ matrix.matlab-release }}
MATLAB_PRODUCT_LIST=${{ env.MATLAB_PRODUCT_LIST }}
tags: |
${{ env.ARCHIVE_BASE_NAME }}:${{ matrix.matlab-release }}
- name: Build final image offline
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ${{ env.ALT_PATH }}
load: true
network: none
build-args: |
MATLAB_RELEASE=${{ matrix.matlab-release }}
MATLAB_PRODUCT_LIST=${{ env.MATLAB_PRODUCT_LIST }}
ARCHIVE_BASE_IMAGE=${{ env.ARCHIVE_BASE_NAME }}:${{ matrix.matlab-release }}
tags: |
${{ env.IMAGE_BASE_NAME }}:${{ matrix.matlab-release }}
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
- name: Generate license file
run: echo '${{ secrets.MATLAB_LICENSE_FILE_R2024A }}' > ${{ env.LICENSE_FILE_PATH }}
- name: Test container
working-directory: tests
env:
IMAGE_NAME: ${{ env.IMAGE_BASE_NAME }}:${{ matrix.matlab-release }}
run: python -m unittest -v ${{ env.ALT_PATH }}/*.py