Skip to content

Update versions #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2.1
orbs:
matlab: mathworks/matlab@0.1.4
codecov: codecov/codecov@1.1.1
matlab: mathworks/matlab@1
codecov: codecov/codecov@4
jobs:
build:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2204:current
steps:
- checkout
- matlab/install
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: matlab-actions/setup-matlab@v0
- uses: matlab-actions/run-tests@v0
- uses: actions/checkout@v4
- uses: matlab-actions/setup-matlab@v2
- uses: matlab-actions/run-tests@v2
with:
source-folder: source
code-coverage-cobertura: coverage.xml
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
with:
file: coverage.xml
file: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

56 changes: 29 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,63 @@
# Use MATLAB with [Codecov](https://codecov.io)

This example shows how to run MATLAB® tests, produce a code coverage report, and upload the report to Codecov. The repository includes these files.
This example shows how to run MATLAB® tests, produce code coverage results, and upload the results to Codecov. The repository includes these files.

| **File Path** | **Description** |
|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `source/quadraticSolver.m` | A function that solves quadratic equations |
| `tests/SolverTest.m` | A class that tests the `quadraticSolver` function |
| `runMyTests.m` | A script that creates a test suite and a test runner that outputs a Cobertura code coverage report |
| `runMyTests.m` | A script that creates a test suite and a test runner that produces code coverage results in Cobertura XML format |
| `azure-pipelines.yml` | A configuration example for [Azure® DevOps](https://marketplace.visualstudio.com/items?itemName=MathWorks.matlab-azure-devops-extension) |
| `.circleci/config.yml` | A configuration example for [CircleCI®](https://circleci.com/orbs/registry/orb/mathworks/matlab)
| `.github/workflows/workflow.yml` | A configuration example for [GitHub® Actions](https://github.com/matlab-actions)
| `.travis.yml` | A configuration example for [Travis CI](https://docs.travis-ci.com/user/languages/matlab/)

## Produce and Publish Coverage Reports
## Produce and Publish Coverage Results
Each of these pipeline definitions does four things:

1) Install the latest MATLAB release on a Linux®-based build agent.
2) Run all MATLAB tests in the root of your repository, including its subfolders.
3) Produce a code coverage report in Cobertura XML format for the `source` folder.
4) Upload the produced artifact to Codecov.
3) Produce code coverage results in Cobertura XML format for the `source` folder.
4) Upload the coverage artifact to Codecov.

### Azure DevOps

```yml
pool:
vmImage: ubuntu-latest
steps:
- task: InstallMATLAB@0
- task: RunMATLABTests@0
- task: InstallMATLAB@1
- task: RunMATLABTests@1
inputs:
sourceFolder: source
codeCoverageCobertura: coverage.xml
- script: bash <(curl -s https://codecov.io/bash)
- script: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code was terse. This replacement is quite verbose and hard to understand. Can I know why we had to make this replacement?

Copy link
Member Author

@davidbuzinski davidbuzinski Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the bash script is still available, but they are moving towards using their CLI going forward. When you setup a new project on codecov.io and choose "Other CI" (Not GitHub Actions or CircleCI) they recommend doing things this way
Screenshot 2024-04-02 at 11 10 25 AM
mend this code:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. Thanks for clarifying, David.

# download Codecov CLI
curl -Os https://cli.codecov.io/latest/linux/codecov

# integrity check
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
curl -Os https://cli.codecov.io/latest/linux/codecov
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM

# upload to Codecov
shasum -a 256 -c codecov.SHA256SUM
sudo chmod +x codecov
./codecov upload-process -t $(CODECOV_TOKEN)
```

### CircleCI

```yml
version: 2.1
orbs:
matlab: mathworks/matlab@0
codecov: codecov/codecov@1
matlab: mathworks/matlab@1
codecov: codecov/codecov@4
jobs:
build:
machine:
image: ubuntu-2004:202104-01
image: ubuntu-2204:current
steps:
- checkout
- matlab/install
Expand All @@ -64,28 +77,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: matlab-actions/setup-matlab@v1
- uses: matlab-actions/run-tests@v1
- uses: actions/checkout@v4
- uses: matlab-actions/setup-matlab@v2
- uses: matlab-actions/run-tests@v2
with:
source-folder: source
code-coverage-cobertura: coverage.xml
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
with:
file: coverage.xml
```

### Travis CI

```yml
language: matlab
script: matlab -batch 'runMyTests'
after_success: bash <(curl -s https://codecov.io/bash)
```

## Caveats
* Currently, MATLAB builds that use cloud-hosted agents are available only for public projects.

## Links
- [Community Boards](https://community.codecov.io)
- [Support](https://codecov.io/support)
Expand Down
20 changes: 17 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
pool:
vmImage: ubuntu-latest
steps:
- task: InstallMATLAB@0
- task: RunMATLABTests@0
- task: InstallMATLAB@1
- task: RunMATLABTests@1
inputs:
sourceFolder: source
codeCoverageCobertura: coverage.xml
- script: bash <(curl -s https://codecov.io/bash)
- script: |
# download Codecov CLI
curl -Os https://cli.codecov.io/latest/linux/codecov

# integrity check
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
curl -Os https://cli.codecov.io/latest/linux/codecov
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM

# upload to Codecov
shasum -a 256 -c codecov.SHA256SUM
sudo chmod +x codecov
./codecov upload-process -t $(CODECOV_TOKEN)
Loading