├── Gemfile ├── .simplecov ├── script.sh ├── .github └── workflows │ ├── enforce-license-compliance.yml │ └── ci.yml ├── Gemfile.lock ├── README.md └── LICENSE.md /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | gem 'bashcov' 6 | gem 'simplecov-cobertura' 7 | -------------------------------------------------------------------------------- /.simplecov: -------------------------------------------------------------------------------- 1 | require 'simplecov' 2 | require 'simplecov-cobertura' 3 | 4 | # Creates a `coverage/coverage.xml` file 5 | SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter 6 | -------------------------------------------------------------------------------- /script.sh: -------------------------------------------------------------------------------- 1 | a_function(){ 2 | echo "$1" 3 | if [ "$1" = "1" ]; 4 | then 5 | echo "hello" 6 | fi 7 | } 8 | 9 | a_function "0" 10 | 11 | a_function "1" 12 | 13 | if [ "a" = "a" ]; 14 | then 15 | echo "hit" 16 | else 17 | echo "missed" 18 | fi 19 | -------------------------------------------------------------------------------- /.github/workflows/enforce-license-compliance.yml: -------------------------------------------------------------------------------- 1 | name: Enforce License Compliance 2 | 3 | on: 4 | pull_request: 5 | branches: [main, master] 6 | 7 | jobs: 8 | enforce-license-compliance: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Enforce License Compliance' 12 | uses: getsentry/action-enforce-license-compliance@57ba820387a1a9315a46115ee276b2968da51f3d # main 13 | with: 14 | fossa_api_key: ${{ secrets.FOSSA_API_KEY }} 15 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | bashcov (1.8.1) 5 | simplecov (~> 0.15) 6 | docile (1.3.5) 7 | rexml (3.2.6) 8 | simplecov (0.21.2) 9 | docile (~> 1.1) 10 | simplecov-html (~> 0.11) 11 | simplecov_json_formatter (~> 0.1) 12 | simplecov-cobertura (2.1.0) 13 | rexml 14 | simplecov (~> 0.19) 15 | simplecov-html (0.12.3) 16 | simplecov_json_formatter (0.1.2) 17 | 18 | PLATFORMS 19 | ruby 20 | 21 | DEPENDENCIES 22 | bashcov 23 | simplecov-cobertura 24 | 25 | BUNDLED WITH 26 | 1.17.3 27 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Test and coverage 2 | 3 | on: push 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | with: 11 | fetch-depth: 2 12 | - uses: ruby/setup-ruby@v1 13 | with: 14 | ruby-version: head 15 | - name: Install Ruby dependencies 16 | run: bundle update --bundler && bundle install 17 | - name: Run script 18 | run: bashcov script.sh 19 | - name: Upload reports to Codecov 20 | uses: codecov/codecov-action@v5 21 | env: 22 | CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} 23 | with: 24 | fail_ci_if_error: true 25 | file: coverage/coverage.xml 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Codecov](https://codecov.io) Bash Example 2 | [![codecov](https://codecov.io/gh/codecov/example-bash/branch/master/graph/badge.svg)](https://codecov.io/gh/codecov/example-bash) 3 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-bash.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-bash?ref=badge_shield) 4 | 5 | ## Guide 6 | 7 | ### Produce Coverage Reports 8 | 9 | ## Caveats 10 | ### Private Repo 11 | Repository tokens are required for (a) all private repos, (b) public repos not using GitHub Actions, Travis-CI, CircleCI or AppVeyor. Find your repository token at Codecov and provide via appending `-t ` to you where you upload reports. 12 | 13 | ## Links 14 | - [Community Boards](https://community.codecov.io) 15 | - [Support](https://codecov.io/support) 16 | - [Documentation](https://docs.codecov.io) 17 | 18 | ## License 19 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fexample-bash.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-bash?ref=badge_large) 20 | 21 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Codecov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------