Skip to content

Build and Test the "MATLAB installer" Dockerfile #82

Build and Test the "MATLAB installer" Dockerfile

Build and Test the "MATLAB installer" Dockerfile #82

# Copyright 2023 The MathWorks, Inc.
name: Build and Test the "MATLAB installer" Dockerfile
# 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-installer/Dockerfile"
- "tests/alternates/matlab-installer/*"
- "tests/utils/**"
- ".github/workflows/matlab-installer-build-test.yml"
- "!**.md"
schedule:
# Run at 00:00 on every Monday (1st Day of the Week)
- cron: "0 0 * * 1"
env:
IMAGE_BASE_NAME: matlab-installer
ALT_PATH: alternates/matlab-installer
jobs:
build-test-image:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
matlab-release:
- R2024b
- R2024a
- R2023b
- R2023a
- R2022b
- R2022a
- R2021b
- R2021a
- R2020b
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Move matlab-install mock to right location
run: |
cp -r tests/${{ env.ALT_PATH }}/mocks/matlab-install ./${{ env.ALT_PATH }}
cp tests/${{ env.ALT_PATH }}/mocks/matlab_installer_input.txt ./${{ env.ALT_PATH }}
- 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: Run negative tests
working-directory: tests
run: python -m unittest ${{ env.ALT_PATH }}/test_failing_build.py
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image locally
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ${{ env.ALT_PATH }}
load: true
build-args: MATLAB_RELEASE=${{ matrix.matlab-release }}
tags: ${{ env.IMAGE_BASE_NAME }}:${{ matrix.matlab-release }}
- 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