Skip to content

Add cross-language symmetry tests for MATLAB ↔ Python DID databases #1

Add cross-language symmetry tests for MATLAB ↔ Python DID databases

Add cross-language symmetry tests for MATLAB ↔ Python DID databases #1

Workflow file for this run

name: Cross-Language Symmetry Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
# Step 1: Run MATLAB makeArtifact tests to generate artifacts
matlab-make-artifacts:
runs-on: ubuntu-latest
steps:
- name: Check out DID-matlab
uses: actions/checkout@v4
with:
repository: VH-Lab/DID-matlab
path: DID-matlab
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: latest
- name: Run MATLAB makeArtifact tests
uses: matlab-actions/run-tests@v2
with:
source-folder: DID-matlab/src/did
select-by-folder: DID-matlab/tests
select-by-tag: ""
test-results-junit: matlab-make-results.xml
start-script: |
addpath(genpath('DID-matlab/src/did'));
addpath(genpath('DID-matlab/tests'));
addpath(genpath('DID-matlab/tools'));
- name: Run MATLAB makeArtifact symmetry tests specifically
uses: matlab-actions/run-command@v2
with:
command: |
addpath(genpath('DID-matlab/src/did'));
addpath(genpath('DID-matlab/tests'));
addpath(genpath('DID-matlab/tools'));
results = runtests('did.symmetry.makeArtifacts', 'IncludeSubpackages', true);
assertSuccess(results);
- name: Upload MATLAB artifacts
uses: actions/upload-artifact@v4
with:
name: matlab-artifacts
path: ${{ runner.temp }}/DID/symmetryTest/matlabArtifacts/
retention-days: 1
# Step 2: Run Python makeArtifact tests, then readArtifact tests (which read both Python + MATLAB artifacts)
python-symmetry:
runs-on: ubuntu-latest
needs: matlab-make-artifacts
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Check out DID-python
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Download MATLAB artifacts
uses: actions/download-artifact@v4
with:
name: matlab-artifacts
path: ${{ runner.temp }}/DID/symmetryTest/matlabArtifacts/
- name: Run Python makeArtifact tests
run: pytest -m make_artifacts -v
- name: Run Python readArtifact tests
run: pytest -m read_artifacts -v
- name: Upload Python artifacts
uses: actions/upload-artifact@v4
with:
name: python-artifacts
path: ${{ runner.temp }}/DID/symmetryTest/pythonArtifacts/
retention-days: 1
# Step 3: Run MATLAB readArtifact tests (reads Python-created artifacts)
matlab-read-artifacts:
runs-on: ubuntu-latest
needs: python-symmetry
steps:
- name: Check out DID-matlab
uses: actions/checkout@v4
with:
repository: VH-Lab/DID-matlab
path: DID-matlab
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: latest
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: ${{ runner.temp }}/DID/symmetryTest/pythonArtifacts/
- name: Download MATLAB artifacts
uses: actions/download-artifact@v4
with:
name: matlab-artifacts
path: ${{ runner.temp }}/DID/symmetryTest/matlabArtifacts/
- name: Run MATLAB readArtifact symmetry tests
uses: matlab-actions/run-command@v2
with:
command: |
addpath(genpath('DID-matlab/src/did'));
addpath(genpath('DID-matlab/tests'));
addpath(genpath('DID-matlab/tools'));
results = runtests('did.symmetry.readArtifacts', 'IncludeSubpackages', true);
assertSuccess(results);