Runs a Salesforce project's Apex tests via TravisCI and reports overall coverage results to Coveralls.
Access to your project's repo will need to be enabled in both Travis and Coveralls. When commits are pushed, the build will run automatically.
Note that these services only support projects hosted on Github. Private repos will require paid accounts at both.
A working project that may be used as a template: sample-apex-library.
Expected file structure is standard; src
folder in root directory and a
valid package.xml
file under it referencing the package's metadata.
A .travis.yml
file will also be needed.
Create a .travis.yml
file at the root of your project. Here's an
example from sample-apex-library:
language: node_js
node_js:
- node
git:
depth: 1
install:
- npm install -g sfdc-travisci-coveralls
script:
- sfdc-travisci-coveralls
The build will also need an org to be run against. A solid option for this is to sign up a free developer org, a separate one for each project.
In the TravisCI configuration for the project, you'll need to add some environment variables:
SFDC_LOGINURL
- eg. https://login.salesforce.comSFDC_USERNAME
- usernameSFDC_PASSWORD
- passwordSFDC_TOKEN
- security tokenCOVERALLS_REPO_TOKEN
- found on the project's Coveralls page
Commit the .travis.yml
file and push.
Travis will immediately start running the build. If either the deployment or tests fail, the build will exit with a failing status.
Steps taken:
- Deploys the package
- Runs tests found in the package on the org
- Retrieves and parses Apex coverage results
- Posts coverage to Coveralls.io