项目作者: 18F

项目描述 :
A utility to wait for Federalist builds before running CI tests
高级语言: JavaScript
项目地址: git://github.com/18F/wait-for-federalist.git
创建时间: 2017-04-25T22:50:12Z
项目社区:https://github.com/18F/wait-for-federalist

开源协议:Other

下载


wait-for-federalist

A utility to wait for Federalist builds before running CI tests, and tell your builds where to look based on the current branch.

:warning: Currently this only works on Circle CI, but could be easily modified to accommodate other services. See metadata.js for how this is currently done.

Install

You can install it with npm or Yarn:

  1. npm install --save-dev wait-for-federalist
  2. # or with Yarn:
  3. yarn add wait-for-federalist

CLI

The wait-for-federalist CLI performns the following steps:

  1. Determine the repository owner, name, branch, and most recent commit SHA from the environment.
  2. Compose a base URL depending on the branch:
    • If the branch is master, the base URL is https://federalist-proxy.app.cloud.gov/site/{owner}/{name}.
    • Otherwise, the base URL is https://federalist.fr.cloud.gov/preview/{owner}/{name}/{branch}.
  3. Request {baseURL}/commit.txt every 2 seconds until its contents match the most recent commit SHA, or the timeout is reached.

wait-for-federalist writes the base URL to stdout, so you can redirect it to a file or pipe it to another process.

CircleCI

The recommended setup on CircleCI is the following:

  1. machine:
  2. node:
  3. version: 4
  4. test:
  5. override:
  6. - $(npm bin)/wait-for-federalist > site_url.txt

Then, in the test.override section, do something with site_url.txt, for instance:

  1. # if you need the site URL as an environment variable
  2. - SITE_URL=$(cat site_url.txt) npm run test-ci
  3. # if you need it as an argument
  4. - npm run test-ci -- --url $(cat site_url.txt)