Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coveralls #493

Merged
merged 7 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workflow "lint, test, build" {
on = "push"
resolves = ["build", "lint", "test"]
resolves = ["build", "lint", "test", "test:e2e"]
}

action "install" {
Expand All @@ -22,6 +22,12 @@ action "lint" {

action "test" {
uses = "actions/npm@master"
args = "run test"
args = "run test:coverage"
needs = ["install"]
}

action "test:e2e" {
uses = "actions/npm@master"
args = "run test:e2e"
needs = ["install"]
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ before_script:
install:
- npm install
script:
- npm run link
- npm run lint
- travis_wait 30 npm run test
- npm run test:coverage
- travis_wait 30 npm run test:e2e
after_success:
- ./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls
- npm run report-coverage
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
# Continous Integration
# Continuous Integration

Having automated CI setup allows us to:

- reduce the feedback loop between the contributor and the reviewer
- make the reviewing task less time-consuming and less prone to human errors

## GitHub Actions
## Setup

### GitHub Actions

The configuration file is located at `.github/main.workflow`.

## Travis CI
### Travis CI

The configuration file is located at `.travis.yml`.

### Coverage

We record the test coverage history using [Coveralls](https://coveralls.io).

Each project has script to run the tests and report them in the `lcov` format.
(see [available reporters](https://istanbul.js.org/docs/advanced/alternative-reporters/))

```json
"test:coverage:ci": "nyc --all --reporter=lcovonly ava"
```

Notes:

- we use the `--all` flag to include all the files (not just the ones touched by our tests)
- the coverage is only calculated for unit & integration tests.

Because we are using a monorepo structure, we need to merge the lcov results before passing them to
coveralls.

```json
"report-coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
```

## Known issues

### Cannot bootstrap all packages concurrently

Our `@aragon/cli-e2e-tests` package has the following dependencies:
Our `@aragon/e2e-tests` package has the following dependencies:

```json
"@aragon/cli": "file:../aragon-cli",
Expand All @@ -31,8 +56,8 @@ The solution is to split the bootstrapping process in two:

```json
"prepare": "npm run bootstrap && npm run bootstrap-e2e-tests",
"bootstrap": "lerna bootstrap --no-ci --ignore @aragon/cli-e2e-tests",
"bootstrap-e2e-tests": "lerna bootstrap --no-ci --scope @aragon/cli-e2e-tests",
"bootstrap": "lerna exec --ignore @aragon/e2e-tests -- npm install",
"bootstrap-e2e-tests": "lerna exec --scope @aragon/e2e-tests -- npm install",
```

Note: this works because when we bootstrap a package, it will get built right after thanks to the
Expand Down
Loading