danger / danger/danger

Documentation or example for circleCI 2.0 workflows

Open
#998 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
5.7k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

I cannot figure out how to use properly danger on circleci 2.0 with workflows

Support I have a linear workflow where I bundle my app / install libraries (`build` job) and then run the tests in parallel. (I'm taking Ruby/Rspec as an example).

How can I execute Danger to report test failures on all containers ?

Currently if a job fails on circleCI, the dependent jobs are not ran (ie if I decide to add a new job `danger-post-rspec` that depends on the `rspec` job, it will be useless since this job will not be ran in case of failure). So I have to execute the Danger code in the same job as the one running rspec. However, this mean the danger code will be run by each container, and possibly danger messages will be replaced.

Can you provide a working example or documentation for a recommended integration of Danger with CircleCI 2.0 workflows ?

Here is the code I have so far

```yaml
jobs:
build: [...]
rspec:
parallelism: 2 # or actually any number >= 2
steps:
- [...]
- run:
name : run rspec tests
command : >
bundle exec rspec [...]
--out ~/rspec/junit.xml
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings --timings-type=filename )
when: always
- store_test_results:
path: ~/rspec
- store_artifacts:
path: ~/rspec
# Dangerfile-RSpec
- run:
name: Skip github fingerprint check that randomly fails
command: mkdir -p ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
when: always
- run:
name: run danger for RSpec tests
command: >
bundle exec danger
--danger_id=danger-rspec
--fail-on-errors=false
--dangerfile=Dangerfile-rspec
when: always
workflows:
version: 2
classic-workflow:
jobs:
- build
- rspec:
requires:
- build
```

(I took the freedom of removing the issue template as it seemed irrelevant, this is about circleci 2 integration and not an actual bug with Danger)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.