This source code demonstrates how to use Coveralls with Bitrise CI/CD in a React.js/React Native app pull requests.
Features originally built from:
- https://github.com/csantarin/keyboard-aware.git
- https://github.com/csantarin/with-staging-testid-poc.git
Replace these with your corresponding details:
<GITHUB_USERNAME>
: Your GitHub username<GITHUB_REPONAME>
: Your GitHub repository name<REPO_TOKEN_HASH_KEY>
: Your GitHub repository token as seen in your Coveralls dashboard.
- Fork this repo. Alternatively, create your own React Native app.
- Add your repo to your Coveralls list.
- Add the Coveralls bot to your repo so that your PRs can receive coverage comments.
- Add the Coveralls GitHub action to your repo workflow to receive Coveralls build updates.
You can do this by simply copying this sample workflow code in .github/workflows/main.yml if you don't have it yet.
- Add your repo to your Bitrise dashboard for build integration.
- Create a PR (containing some new changes) to your repo..
You'll need to integrate the Coveralls bot to your repo in order to receive PR comments on test coverage.
See also: lemurheavy/coveralls-public#1313 (comment)
- On your repo, go to Settings > Manage Access.
- Click Invite a collaborator.
- Enter
coveralls
. - Click Add coveralls to [your-repo].
- Wait for the Coveralls bot to accept your invitation within 10 minutes.
- Connect to Coveralls using your GitHub account.
- Add your repo to your Coveralls list.
- Visit your Coveralls repo settings at
https://coveralls.io/github/<GITHUB_USERNAME>/<GITHUB_REPONAME>/settings
- Enable notifications under PULL REQUESTS ALERTS. Set the following:
- LEAVE COMMENTS? to
ENABLED
. - FORMAT: to
detailed
. - COVERAGE THRESHOLD FOR FAILURE to a percentage to indicate minimum allowed coverage.
- COVERAGE DECREASE THRESHOLD FOR FAILURE to a percentage to indicate minimum allowed loss of coverage.
- LEAVE COMMENTS? to
As of 2020-09-07, Bitrise cannot trigger the @coveralls bot to produce comments on GitHub PRs. Coveralls doesn't support Bitrise integration, which is why GitHub actions is necessary.
These instructions assume that you use the preconfigured Bitrise workflow without any changes.
- Connect to Bitrise with your GitHub account.
- Follow the steps outlined in this video tutorial to add your repos to Bitrise.
- Configure your repo's Bitrise triggers to run the build (upon push / pull request / tag) as required. The target workflow should be
primary
.
These instructions assume that you have these tools as dependencies to your project.
jest
: testing the code and generating test reportscoveralls
: uploading test reports to coveralls.io.
- Clone your repo.
git clone git@github.com:<GITHUB_USERNAME>/<GITHUB_REPONAME>.git # or git clone https://github.com/<GITHUB_USERNAME>/<GITHUB_REPONAME>.git
If you prefer to not fork this repo, you may create your own, but take note of the minimum Node dependencies above.
- Install its dependencies.
yarn
- Make changes.
- Run tests to make sure that your code doesn't fail.
yarn test
The following instructions assumes that you use other CI integration besides Bitrise, or when you choose to upload test reports manually.
- (optional) Create a .coveralls.yml file using .coveralls.example.yml as reference. Replace
<REPO_TOKEN_HASH_KEY>
accordingly. - (optional) Upload your local test results to Coveralls for immediate reports. See package.json for reference.
yarn coverage