{"id":17128999,"url":"https://github.com/michaelhenry/swifty-code-coverage","last_synced_at":"2025-04-13T07:10:38.922Z","repository":{"id":40941418,"uuid":"480881474","full_name":"michaelhenry/swifty-code-coverage","owner":"michaelhenry","description":"A github action for generating code coverage report for your ios/macos/spm project.","archived":false,"fork":false,"pushed_at":"2023-03-07T15:38:08.000Z","size":21,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T07:09:33.839Z","etag":null,"topics":["codeclimate","codecov","codecoverage","lcov","lcov-report","reporting","testing"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelhenry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-12T16:06:19.000Z","updated_at":"2025-01-17T16:50:06.000Z","dependencies_parsed_at":"2022-08-29T07:31:24.578Z","dependency_job_id":null,"html_url":"https://github.com/michaelhenry/swifty-code-coverage","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"3183f5a7c7d27489becc962f988e1b93040d27b4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2Fswifty-code-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2Fswifty-code-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2Fswifty-code-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhenry%2Fswifty-code-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhenry","download_url":"https://codeload.github.com/michaelhenry/swifty-code-coverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675424,"owners_count":21143768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeclimate","codecov","codecoverage","lcov","lcov-report","reporting","testing"],"created_at":"2024-10-14T19:08:35.804Z","updated_at":"2025-04-13T07:10:38.861Z","avatar_url":"https://github.com/michaelhenry.png","language":"Shell","readme":"# swifty-code-coverage\n\nA github action for generating code coverage report for your ios/macos/spm project.\n\n[![codecov](https://codecov.io/gh/michaelhenry/swifty-code-coverage/branch/main/graph/badge.svg?token=I7B7SJCM34)](https://codecov.io/gh/michaelhenry/swifty-code-coverage)\n\n## Example\n\nHere is an actual workflow (https://github.com/michaelhenry/create-report/actions/runs/2156329862) that uses this action and it produced a codecov report on this PR (https://github.com/michaelhenry/create-report/pull/14).\n\n### Codecov\n\n```yml\njobs:\n  code-coverage-report:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Test\n        uses: actions/checkout@v1\n      - run: swift test --enable-code-coverage\n      - uses: michaelhenry/swifty-code-coverage@v1.0.0\n        with:\n          build-path: .build\n          target: GithubChecksPackageTests.xctest\n          is-spm: true\n      - name: Upload to Codecov\n        run: |\n          bash \u003c(curl https://codecov.io/bash) -f \"coverage/*.info\"\n        shell: bash\n        env:\n          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}\n```\n\n### Code Climate\n\n```yml\njobs:\n  code-coverage-report:\n    runs-on: macos-latest\n    steps:\n      - uses: actions/checkout@v1\n      - run: xcodebuild test -project App.xcodeproj -scheme App -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X,OS=13.0' -enableCodeCoverage YES -derivedDataPath DerivedData\n      - uses: michaelhenry/swifty-code-coverage@v1.0.0\n        with:\n          build-path: DerivedData\n          target: App.app\n          is-spm: false\n      - name: Publish to code climate\n        uses: paambaati/codeclimate-action@v3.0.0\n        env:\n          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}\n        with:\n          coverageLocations: |\n            coverage/lcov.info:lcov\n```\n\n\u003e For some reason even though the code-coverage was generate from the same llvm version, codeclimate is returning an error \" ./cc-test-reporter: cannot execute binary file: Exec format error\" when using an ubuntu machine.\n\n## Note\n\nIf your project is an SPM project, please use the `.xctest` file as `target` which was generated from `swift test --enable-code-coverage` and set the `is-spm` to `true`.\n\nEg.\n\n```yml\n  - run: swift test --enable-code-coverage\n  - uses: michaelhenry/swifty-code-coverage@v1.0.0\n    with:\n      build-path: .build\n      target: AppTests.xctest\n      is-spm: true\n```\n\nOtherwise, if your project is an ios/macos that uses the `xcodebuild test` to test, please use the `.app` as `target` which was the file generated from the `xcodebuild test -enableCodeCoverage YES`  and set the `is-spm` to `false`.\n\nEg.\n\n```yml\n  - run: xcodebuild test -project App.xcodeproj -scheme App -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X,OS=13.0' -enableCodeCoverage YES -derivedDataPath DerivedData\n  - uses: michaelhenry/swifty-code-coverage@v1.0.0\n    with:\n      build-path: DerivedData\n      target: App.app\n      is-spm: false\n```\n\n## FAQ\n\n### How to ignore view controller files?\n\nJust add the regex for `*ViewController.swift` as `ignore-filename-regex` param.\n\nFor example:\n\n```yml\n- uses: michaelhenry/swifty-code-coverage@v1.0.0\n  with:\n    build-path: DerivedData\n    target: Demo.app\n    is-spm: false\n    ignore-filename-regex: '^[\\w,\\s-]+ViewController\\.swift$'\n```\n### Don't want to use other third party code coverage service for the report or analysis?\n\nYou can still view the code coverage report from the logs(stdout) of llvm-cov report.\n\nEg.\n\n\u003cimg width=\"1302\" alt=\"Screen Shot 2022-11-02 at 01 51 54\" src=\"https://user-images.githubusercontent.com/717992/199263153-22d35899-66d9-404a-b682-0b453de314a8.png\"\u003e\n\n## Sample Apps or libraries that uses this action that you can use as guide.\n\n- [michaelhenry/Prettier.swift](https://github.com/michaelhenry/Prettier.swift)\n- [michaelhenry/create-report](https://github.com/actions-marketplace-validations/create-report)\n- [michaelhenry/SimpleXMLParser](https://github.com/michaelhenry/SimpleXMLParser)\n- [lukeredpath/swift-responsive-textfield](https://github.com/lukeredpath/swift-responsive-textfield)\n- [shayan18/ApiClient-iOS](https://github.com/shayan18/ApiClient-iOS)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2Fswifty-code-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhenry%2Fswifty-code-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhenry%2Fswifty-code-coverage/lists"}