testing python 3.13 #86
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Measure Python & MATLAB Code Coverage | |
env: | |
CLONE_PATH: ${{ github.workspace }} | |
BENDFO_M_PATH: ${{ github.workspace }}/BenDFO/m | |
BENDFO_DATA_PATH: ${{ github.workspace }}/BenDFO/data | |
POUNDERS_PATH: ${{ github.workspace }}/pounders/m | |
MSAMP_PATH: ${{ github.workspace }}/manifold_sampling/m | |
PY_COV_FILE: coverage_ibcdfo | |
PY_COV_XML_FILE: cobertura_ibcdfo_py.xml | |
PY_COV_HTML_FILE: htmlcov_ibcdfo_py | |
POUNDERS_M_COV_HTML_FILE: htmlcov_ibcdfo_pounders_m | |
POUNDERS_M_COV_XML_FILE: cobertura_ibcdfo_pounders_m.xml | |
MSAMP_M_COV_HTML_FILE: htmlcov_ibcdfo_msamp_m | |
MSAMP_M_COV_XML_FILE: cobertura_ibcdfo_msamp_m.xml | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
# ----- MEASURE COVERAGE ACROSS ALL PYTHON PACKAGES | |
coverage_py: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# We only need to measure coverage with a single test setup. Ideally | |
# this will be the latest version of python supported. | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.13"] | |
steps: | |
# -- General Setup Steps | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Python with tox | |
run: $CLONE_PATH/.github/workflows/setup_tox_github_action.sh | |
# -- Run Coverage for All Python Packages | |
- name: Generate Python coverage reports | |
run: | | |
pushd $CLONE_PATH/ibcdfo_pypkg | |
COVERAGE_FILE=$PY_COV_FILE COVERAGE_XML_FILE=$PY_COV_XML_FILE COVERAGE_HTML_FILE=$PY_COV_HTML_FILE tox -r -e coverage,report | |
mv $PY_COV_FILE $CLONE_PATH | |
mv $PY_COV_XML_FILE $CLONE_PATH | |
mv $PY_COV_HTML_FILE $CLONE_PATH | |
popd | |
# -- Publish as artifact for users and subsequent jobs | |
- name: Archive Python coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-coverage-results | |
path: | | |
${{ env.PY_COV_FILE }} | |
${{ env.PY_COV_XML_FILE }} | |
${{ env.PY_COV_HTML_FILE }} | |
# ----- MEASURE COVERAGE ACROSS ALL MATLAB PACKAGES | |
coverage_m: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# We only need to measure coverage with a single test setup. Ideally | |
# this will be the latest MATLAB release supported. | |
matrix: | |
os: [ubuntu-latest] | |
matlab-release: ["R2024b"] | |
steps: | |
# -- General Setup Steps | |
- name: Checkout IBCDFO repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Checkout BenDFO repository | |
uses: actions/checkout@v4 | |
with: | |
repository: POptUS/BenDFO | |
path: BenDFO | |
- name: Set up MATLAB ${{ matrix.matlab-release }} | |
uses: matlab-actions/setup-matlab@v2 | |
with: | |
release: ${{ matrix.matlab-release }} | |
products: Optimization_Toolbox | |
# -- Test Execution Step | |
# This requires R2023b or higher | |
- name: Generate code coverage report for MATLAB code | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: > | |
addpath("${{ env.BENDFO_M_PATH }}"), | |
addpath("${{ env.BENDFO_DATA_PATH }}"), | |
cd ${{ env.POUNDERS_PATH }}, | |
[results, cov_p] = runtests("IncludeSubfolders", true, "ReportCoverageFor", pwd), | |
assertSuccess(results), | |
cd ${{ env.MSAMP_PATH }}, | |
[results, cov_ms] = runtests("IncludeSubfolders", true, "ReportCoverageFor", pwd), | |
assertSuccess(results), | |
cd ${{ env.CLONE_PATH }}, | |
fp = generateHTMLReport(cov_p, "${{ env.POUNDERS_M_COV_HTML_FILE }}"), | |
generateCoberturaReport(cov_p, "${{ env.POUNDERS_M_COV_XML_FILE }}"); | |
fp = generateHTMLReport(cov_ms, "${{ env.MSAMP_M_COV_HTML_FILE }}"), | |
generateCoberturaReport(cov_ms, "${{ env.MSAMP_M_COV_XML_FILE }}"); | |
# -- Publish as artifact for users and subsequent jobs | |
- name: Archive MATLAB coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: matlab-coverage-results | |
path: | | |
${{ env.POUNDERS_M_COV_HTML_FILE }} | |
${{ env.POUNDERS_M_COV_XML_FILE }} | |
${{ env.MSAMP_M_COV_HTML_FILE }} | |
${{ env.MSAMP_M_COV_XML_FILE }} | |
# ----- PUBLISH FULL CODE COVERAGE REPORT | |
publish: | |
needs: [coverage_py, coverage_m] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Access Python coverage reports | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-coverage-results | |
path: ${{ env.CLONE_PATH }} | |
- name: Access MATLAB coverage reports | |
uses: actions/download-artifact@v4 | |
with: | |
name: matlab-coverage-results | |
path: ${{ env.CLONE_PATH }} | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: | | |
${{ env.CLONE_PATH }}/${{ env.POUNDERS_M_COV_XML_FILE }}, | |
${{ env.CLONE_PATH }}/${{ env.MSAMP_M_COV_XML_FILE }}, | |
${{ env.CLONE_PATH }}/${{ env.PY_COV_XML_FILE }} | |
fail_ci_if_error: true |