Skip to content

Update codecov.yml #125

Update codecov.yml

Update codecov.yml #125

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
- name: Connect to King Server & Setup Rebase
run: |
ssh saleh@king << 'EOF'
# Navigate to home directory
cd ~
# Clone or update COBRA Toolbox
if [ ! -d "cobratoolbox" ]; then
git clone https://github.com/opencobra/cobratoolbox.git
fi
cd cobratoolbox
# Ensure develop is up-to-date
git fetch origin develop
git checkout develop
git reset --hard origin/develop
# Fetch and rebase the PR branch
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout -b pr-rebase FETCH_HEAD
git rebase develop
# If rebase fails, abort and exit
if [ $? -ne 0 ]; then
git rebase --abort
exit 1
fi
# Run MATLAB tests
matlab -batch "run('cobratoolbox/initCobraToolbox.m'); diary('test_results.txt'); run('cobratoolbox/test/testAll.m'); diary off;"
# Exit SSH session
exit
EOF
- name: Upload Test Report
uses: actions/upload-artifact@v4
with:
name: test-report
path: ~/cobratoolbox/test_results.txt
- name: Upload Coverage to Codecov
if: always()
uses: codecov/codecov-action@v3
with:
files: ~/cobratoolbox/CodeCovTestResults.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
flags: matlab
comment: true