From 757a86c6edc23a78b6e3dced8c81b50460818d21 Mon Sep 17 00:00:00 2001 From: Farid Zare Date: Wed, 5 Feb 2025 18:58:13 +0000 Subject: [PATCH 1/5] Update codecov.yml --- codecov.yml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/codecov.yml b/codecov.yml index e7e3922bc7..43cc29d463 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,20 +1,7 @@ -# codecov.yml - -# Comment settings comment: - layout: "reach, diff, flags, files" - behavior: default # Shows the comment only on the first push of a pull request - require_changes: true # Only comment if there are coverage changes - -# Coverage status checks -coverage: - status: - project: - default: - target: auto # Automatically adjust coverage goal - threshold: 1% # Fail PRs that reduce coverage by more than 1% - patch: - default: - target: auto - threshold: 1% - + layout: "header, diff, flags, components, files, footer" + behavior: default + require_changes: false + require_base: false + require_head: true + hide_project_coverage: false From bf6ba088495bae6a1f09bb9617beca484ce9e296 Mon Sep 17 00:00:00 2001 From: Farid Zare Date: Wed, 5 Feb 2025 18:58:59 +0000 Subject: [PATCH 2/5] Update testAll.m --- test/testAll.m | 85 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/test/testAll.m b/test/testAll.m index 089d046139..e66aec4c11 100644 --- a/test/testAll.m +++ b/test/testAll.m @@ -15,7 +15,7 @@ % request explicitly from the user to launch test suite locally % if contains(getenv('HOME'), 'vmhadmin') || contains(getenv('HOME'), 'jenkins') -if contains(getenv('HOME'), 'cobratoolbox') +if contains(getenv('HOME'), 'saleh') % Running in CI environment % fprintf('Running test in Jenkins/CI environment\n'); fprintf('Running test in cobratoolbox/CI environment\n'); @@ -182,6 +182,76 @@ sumFailed = sum(resultTable.Failed); fprintf(['\n > ', num2str(sumFailed), ' tests failed. ', num2str(sumSkipped), ' tests were skipped due to missing requirements.\n\n']); + %% NEW: Generate JUnit XML report for Codecov + + xmlFileName = 'testReport.junit.xml'; + + fid = fopen(xmlFileName, 'w'); + if fid == -1 + error('Could not open file for writing: %s', xmlFileName); + end + + fprintf(fid, '\n'); + + numTests = height(resultTable); + numFailures = sum(resultTable.Failed); + numErrors = sum(resultTable.Failed); + numSkipped = sum(resultTable.Skipped); + + % Compute total time and also count how many are "failures" vs. "errors" + totalTime = sum(resultTable.Time); + + % 1) Wrap in -- typical JUnit format + fprintf(fid, '\n', ... + numTests, numFailures, numErrors, totalTime); + + % 2) A single inside + fprintf(fid, ' \n', ... + numTests, numFailures, numErrors, numSkipped, totalTime); + + % 3) Loop over each test case + for i = 1:numTests + testName = resultTable.TestName{i}; + if isnan(resultTable.Time(i)) + tVal = 0; + else + tVal = resultTable.Time(i); + end + + % Start the tag + fprintf(fid, ' just close + fprintf(fid, '/>\n'); + elseif resultTable.Skipped(i) + % Skipped => + fprintf(fid, '>\n'); + fprintf(fid, ' \n', escapeXML(resultTable.Details{i})); + fprintf(fid, ' \n'); + else + % Not passed, not skipped => either or + % Check the .Error or .Details to decide + errMsg = result(i).Error.message; % or getReport() + + % Heuristic: if "Assertion" => , else . + if contains(errMsg, 'Assertion') || contains(errMsg, 'assert') + fprintf(fid, '>\n'); + fprintf(fid, ' \n', escapeXML(errMsg)); + else + fprintf(fid, '>\n'); + fprintf(fid, ' \n', escapeXML(errMsg)); + end + + fprintf(fid, ' \n'); + end + end + + % Close out the suite and suites + fprintf(fid, ' \n'); + fprintf(fid, '\n'); + fclose(fid); + %% End of XML generation % count the number of covered lines of code if COVERAGE @@ -291,3 +361,16 @@ % explicit 'exit' required for R2018b in non-interactive mode to avoid SEGV near end of test exit end + +%% Local helper function to escape XML special characters. +function out = escapeXML(in) + if isempty(in) + out = ''; + return; + end + out = strrep(in, '&', '&'); + out = strrep(out, '<', '<'); + out = strrep(out, '>', '>'); + out = strrep(out, '"', '"'); + out = strrep(out, '''', '''); +end From df7e277450af3ab4986752aa4790af45266502b3 Mon Sep 17 00:00:00 2001 From: Farid Zare Date: Wed, 5 Feb 2025 19:00:04 +0000 Subject: [PATCH 3/5] Delete .github/workflows/codecov.yml --- .github/workflows/codecov.yml | 37 ----------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index ede5e46048..0000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Code Coverage -on: - push: - branches: [develop] - pull_request: - branches: [develop] -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up MATLAB - uses: matlab-actions/setup-matlab@v1 - with: - release: R2022a - - - name: Install MOcov - run: | - git clone https://github.com/MOxUnit/MOcov.git /opt/MOcov - sudo chmod -R 755 /opt/MOcov - - - name: Verify MATLAB installation - run: matlab -batch "version" - - - name: Run MATLAB tests - run: | - matlab -batch "addpath(genpath(pwd)); run_coverage_tests" - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./coverage.xml - flags: matlab - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - comment: true From 786a6debc9d2fd301911030e79c2310834599605 Mon Sep 17 00:00:00 2001 From: Farid Zare Date: Wed, 5 Feb 2025 19:00:55 +0000 Subject: [PATCH 4/5] Update and rename testall.yml to cobratoolboxCI.yml --- .github/workflows/cobratoolboxCI.yml | 29 ++++++++++++++++++++++++++++ .github/workflows/testall.yml | 25 ------------------------ 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/cobratoolboxCI.yml delete mode 100644 .github/workflows/testall.yml diff --git a/.github/workflows/cobratoolboxCI.yml b/.github/workflows/cobratoolboxCI.yml new file mode 100644 index 0000000000..9563b55148 --- /dev/null +++ b/.github/workflows/cobratoolboxCI.yml @@ -0,0 +1,29 @@ +name: Example +on: + pull_request: + branches: + - master + - main + - develop +jobs: + build: + runs-on: self-hosted + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Merge base branch into PR + run: | + git fetch origin ${{ github.base_ref }} + git merge origin/${{ github.base_ref }} + + - name: Run MATLAB Tests + run: | + matlab -batch "run('initCobraToolbox.m'); run('test/testAll.m');" + + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: testReport.junit.xml diff --git a/.github/workflows/testall.yml b/.github/workflows/testall.yml deleted file mode 100644 index 4c5b75523f..0000000000 --- a/.github/workflows/testall.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: MATLAB Tests -on: - pull_request: - branches: - - '**' - -jobs: - build: - runs-on: self-hosted - steps: - - uses: actions/checkout@v2 - - - name: Clone COBRA Toolbox - run: | - git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox - - - name: Run MATLAB tests - run: | - matlab -batch "run('cobratoolbox/initCobraToolbox.m'); diary('test_results.txt'); run('cobratoolbox/runTestsAndGenerateReport.m'); diary off;" - - - name: Upload Test Report - uses: actions/upload-artifact@v4 - with: - name: test-report - path: test_results.txt From 280e6bf376fbdd1b427cce7eea820601c6aac560 Mon Sep 17 00:00:00 2001 From: rmtfleming Date: Thu, 6 Feb 2025 12:20:33 +0000 Subject: [PATCH 5/5] deploy: 4a45a0782f96d31bc3d56cc3e6a1d326e6376ccb --- .nojekyll | 0 docs/contributors.html | 148 ++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 74 deletions(-) create mode 100644 .nojekyll diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/contributors.html b/docs/contributors.html index 4971d20420..13d5475bea 100644 --- a/docs/contributors.html +++ b/docs/contributors.html @@ -377,13 +377,13 @@

@@ -392,13 +392,13 @@

@@ -421,6 +421,11 @@

ThummaratPaklao

+ +
Sami990

Sami990

@@ -432,13 +437,13 @@

@@ -447,8 +452,8 @@

@@ -461,11 +466,6 @@

FilippoMart

- -
Moremo1996

Moremo1996

@@ -599,11 +599,6 @@

bertonoronha

- -
mapoliveira

mapoliveira

@@ -645,13 +640,13 @@

@@ -660,13 +655,13 @@

- hhefzi -

hhefzi

+ KadirKcbs +

KadirKcbs

@@ -675,23 +670,18 @@

- KadirKcbs -

KadirKcbs

-
- -
- edkerk -

edkerk

+ hhefzi +

hhefzi

@@ -700,18 +690,18 @@

@@ -720,18 +710,23 @@

- bheavner -

bheavner

+ fplanes +

fplanes

- NebulaKit -

NebulaKit

+ sriki18 +

sriki18

+
+ +
@@ -740,18 +735,18 @@

- sriki18 -

sriki18

+ bheavner +

bheavner

@@ -760,8 +755,8 @@

@@ -794,11 +789,6 @@

akinsse

-
- simas232 -

simas232

-
-
bronsonweston

bronsonweston

@@ -810,8 +800,8 @@

- pavaoa -

pavaoa

+ nigiord +

nigiord

@@ -844,6 +834,11 @@

amnag

+
+ annasheehy +

annasheehy

+
+
gogo1988

gogo1988

@@ -889,6 +884,11 @@

yunbum-kook

+
+ pavaoa +

pavaoa

+
+
AndrasHartmann

AndrasHartmann

@@ -940,13 +940,13 @@