Skip to content

Update codecov.yml #122

Update codecov.yml

Update codecov.yml #122

Workflow file for this run

name: MATLAB Tests and Code Coverage
on:
pull_request:
branches:
- '**'
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout PR Code
uses: actions/checkout@v4 # Fetches the PR branch
- name: Merge PR Branch with Develop
run: |
git fetch origin
git checkout -b test-merge
git merge origin/develop --allow-unrelated-histories --no-edit
git push origin test-merge --force # Push the merged branch temporarily
- name: Clone Merged Branch on King Server
run: |
ssh saleh@king "rm -rf cobratoolbox && git clone -b test-merge https://github.com/opencobra/cobratoolbox.git cobratoolbox"
- name: Run MATLAB Tests on King Server
run: |
ssh saleh@king "matlab -batch \"run('cobratoolbox/initCobraToolbox.m'); diary('test_results.txt'); run('cobratoolbox/test/testAll.m'); diary off;\""
- name: Retrieve Test Results from Server
run: |
scp saleh@king:cobratoolbox/test_results.txt .
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: test-report
path: test_results.txt
- name: Upload Coverage to Codecov
if: always() # Ensure it runs even if tests fail
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/CodeCovTestResults.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: matlab
comment: true
- name: Upload Test Results to Codecov
if: always()
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Cleanup Temporary Merged Branch
if: always()
run: |
git push origin --delete test-merge || true # Delete the test-merge branch after tests