Skip to content

Commit

Permalink
Update Action versions (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbuzinski authored Apr 11, 2024
1 parent f772988 commit 40d9175
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 41 deletions.
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: |
# 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)

0 comments on commit 40d9175

Please sign in to comment.