Skip to content

Update codecov.yml #123

Update codecov.yml

Update codecov.yml #123

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: Rebase PR Branch on Top of Develop
run: |
git fetch origin
git checkout ${{ github.event.pull_request.head.ref }} # Checkout PR branch
git rebase origin/develop # Rebase PR branch on develop
git push origin +HEAD:test-rebase --force # Push rebased branch
- name: Clone Rebased Branch on King Server
run: |
ssh saleh@king "rm -rf cobratoolbox && git clone -b test-rebase 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 Rebased Branch
if: always()
run: |
git push origin --delete test-rebase || true # Delete the test-rebase branch after tests