diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d02b5e..6fe4fb1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ae867f0..c5bd679 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 \ No newline at end of file + file: coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8353f9d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: matlab -script: matlab -batch 'runMyTests' -after_success: bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 6ed2034..c9fde60 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,23 @@ # 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 @@ -26,12 +25,26 @@ Each of these pipeline definitions does four things: 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 @@ -39,12 +52,12 @@ steps: ```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 @@ -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) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 98f41ee..e84851c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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)