diff --git a/README.md b/README.md index 77fdf0bc2..6c311027b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,11 @@ -# Danger JS :no_entry_sign: - -[![npm](https://img.shields.io/npm/v/danger.svg)](https://www.npmjs.com/package/danger) -[![Build Status](https://travis-ci.org/danger/danger-js.svg?branch=master)](https://travis-ci.org/danger/danger-js) -[![Build Status](https://ci.appveyor.com/api/projects/status/ep5hgeox3lbc5c7f?svg=true)](https://ci.appveyor.com/project/orta/danger-js/branch/master) +# Danger JS :no_entry_sign: [![npm](https://img.shields.io/npm/v/danger.svg)](https://www.npmjs.com/package/danger) [![Build Status](https://travis-ci.org/danger/danger-js.svg?branch=master)](https://travis-ci.org/danger/danger-js) [![Build Status](https://ci.appveyor.com/api/projects/status/ep5hgeox3lbc5c7f?svg=true)](https://ci.appveyor.com/project/orta/danger-js/branch/master) Formalize your Pull Request etiquette.

What is Danger JS?Vision • - Helping Out • + Helping OutPlugin Development

@@ -21,6 +17,8 @@ This provides another logical step in your process, through this Danger can help You can use Danger to codify your teams norms, leaving humans to think about harder problems. +Danger JS currently works with GitHub and Travis CI, Circle CI, Semaphore, Jenkins, Docker Cloud, surf-build, Codeship, Drone, Buildkite, or buddybuild. + ## For example? You can: @@ -38,7 +36,7 @@ Danger provides the glue to let _you_ build out the rules specific to your team' Alright. So, actually, you may be in the wrong place. From here on in, this README is going to be for people who are interested in working on and improving on Danger JS. -We keep all of the end-user documentation at . +We keep all of the end-user documentation at . Some quick links to get you started: @@ -67,6 +65,9 @@ yarn test yarn lint ``` +The fixers for both tslint and prettier will be applied when you commit, and on a push your code will be verified +that it compiles. + ### What is the TODO? Check the issues, I try and keep my short term perspective there. Long term is in the [VISION.md](VISION.md). diff --git a/changelog.md b/changelog.md index 96f771465..407699f68 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ### Master +- Adds inline docs for all CI providers - orta + ### 0.21.1 - Use HTTP for the GitHub status check target URL - macklinu diff --git a/source/ci_source/providers/BuddyBuild.ts b/source/ci_source/providers/BuddyBuild.ts index 2ff154478..1cc672c9e 100644 --- a/source/ci_source/providers/BuddyBuild.ts +++ b/source/ci_source/providers/BuddyBuild.ts @@ -1,6 +1,20 @@ import { Env, CISource } from "../ci_source" import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "../ci_source_helpers" +/** + * ### CI Setup + * + * Buddybuild has an integration for Danger JS already built-in. + * + * ### Token Setup + * + * Login to buddybuild and select your app. Go to your *App Settings* and + * in the *Build Settings* menu on the left, choose *Environment Variables*. + * + * #### GitHub + * Add the `DANGER_GITHUB_API_TOKEN` to your build user's ENV. + * + */ export class BuddyBuild implements CISource { constructor(private readonly env: Env) {} diff --git a/source/ci_source/providers/Buildkite.ts b/source/ci_source/providers/Buildkite.ts index ffe4cce58..101cff405 100644 --- a/source/ci_source/providers/Buildkite.ts +++ b/source/ci_source/providers/Buildkite.ts @@ -1,6 +1,24 @@ import { Env, CISource } from "../ci_source" import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "../ci_source_helpers" +/** + * ### CI Setup + * + * With BuildKite you run the server yourself, so you will want to run it as a part of your build process. + * It is common to have build steps, so we would recommend adding this to your scrip: + * + * ``` shell + * echo "--- Running Danger" + * bundle exec danger + * ``` + * + * ### Token Setup + * + * #### GitHub + * + * As this is self-hosted, you will need to add the `DANGER_GITHUB_API_TOKEN` to your build user's ENV. The alternative + * is to pass in the token as a prefix to the command `DANGER_GITHUB_API_TOKEN="123" bundle exec danger`. + */ export class Buildkite implements CISource { constructor(private readonly env: Env) {} diff --git a/source/ci_source/providers/Codeship.ts b/source/ci_source/providers/Codeship.ts index c056938ac..5d69a3de3 100644 --- a/source/ci_source/providers/Codeship.ts +++ b/source/ci_source/providers/Codeship.ts @@ -2,8 +2,36 @@ import { Env, CISource } from "../ci_source" import { ensureEnvKeysExist, getPullRequestIDForBranch } from "../ci_source_helpers" /** - * Docs: TODO + * ### CI Setup + * + * To make Danger run, add a new step to the `codeship-steps.yml` file: + * + * ``` + * - type: parallel: + * ... + * - name: danger + * service: web + * command: yarn danger + * ``` + * + * If you're using Codeship Classic, add `yarn danger` to your 'Test Commands' + * + * ### Token Setup + * + * You'll want to edit your `codeship-services.yml` file to include a reference + * to the Danger authentication token: `DANGER_GITHUB_API_TOKEN`. + * + * ``` + * project_name: + * ... + * environment: + * - DANGER_GITHUB_API_TOKEN=[my_token] + * ``` + * + * If you're using Codeship Classic, add `DANGER_GITHUB_API_TOKEN` to your + * 'Environment' settings. */ + export class Codeship implements CISource { private default = { prID: "0" } constructor(private readonly env: Env) {} diff --git a/source/ci_source/providers/DockerCloud.ts b/source/ci_source/providers/DockerCloud.ts index cc4a0a51d..b2ef3a7b6 100644 --- a/source/ci_source/providers/DockerCloud.ts +++ b/source/ci_source/providers/DockerCloud.ts @@ -2,8 +2,33 @@ import { Env, CISource } from "../ci_source" import { ensureEnvKeysExist } from "../ci_source_helpers" /** - * Docs: TODO + * + * ### CI Setup + * + * You'll want to add danger to your existing `Dockerfile.test` (or whatever you + * have choosen as your `sut` Dockerfile.) + * + * ```sh + * ... + * + * CMD ["yarn", "danger"] + * ``` + * + * ### Token Setup + * + * #### GitHub + * + * Your `DANGER_GITHUB_API_TOKEN` will need to be exposed to the `sut` part of your + * `docker-compose.yml`. This looks similar to: + * + * ``` + * sut: + * ... + * environment: + * - DANGER_GITHUB_API_TOKEN=[my_token] + * ``` */ + export class DockerCloud implements CISource { constructor(private readonly env: Env) {} diff --git a/source/ci_source/providers/Jenkins.ts b/source/ci_source/providers/Jenkins.ts index 26a79beeb..1748baa89 100644 --- a/source/ci_source/providers/Jenkins.ts +++ b/source/ci_source/providers/Jenkins.ts @@ -1,28 +1,29 @@ import { Env, CISource } from "../ci_source" import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "../ci_source_helpers" + +// https://jenkins.io/ + /** - * https://jenkins-ci.org - * - * ### CI Setup - * Ah Jenkins, so many memories. So, if you're using Jenkins, you're hosting your own environment. + * ### CI Setup + * Ah Jenkins, so many memories. So, if you're using Jenkins, you're hosting your own environment. * - * ### GitHub - * You will want to be using the - * [GitHub pull request builder plugin](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin) - * in order to ensure that you have the build environment set up for PR integration. + * ### GitHub + * You will want to be using the + * [GitHub pull request builder plugin](https://wiki.jenkins.io/display/JENKINS/GitHub+pull+request+builder+plugin) + * in order to ensure that you have the build environment set up for PR integration. * - * With that set up, you can edit your job to add `yarn danger` at the build action. + * With that set up, you can edit your job to add `yarn danger` at the build action. * - * ### Pipeline + * ### Pipeline * If you're using [pipelines](https://jenkins.io/solutions/pipeline/) you should be using the - * [GitHub branch source plugin](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Branch+Source+Plugin) for easy setup and handling of PRs. + * [GitHub branch source plugin](https://wiki.jenkins.io/display/JENKINS/GitHub+Branch+Source+Plugin) for easy setup and handling of PRs. * - * After you've set up the plugin, add a `sh 'yarn danger'` line in your pipeline script and make sure that build PRs is enabled. + * After you've set up the plugin, add a `sh 'yarn danger'` line in your pipeline script and make sure that build PRs is enabled. * - * ## Token Setup + * ## Token Setup * - * ### GitHub - * As you own the machine, it's up to you to add the environment variable for the `DANGER_GITHUB_API_TOKEN`. + * ### GitHub + * As you own the machine, it's up to you to add the environment variable for the `DANGER_GITHUB_API_TOKEN`. */ export class Jenkins implements CISource { constructor(private readonly env: Env) {}