Coder Social home page Coder Social logo

wait-for-federalist's Introduction

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.

โš ๏ธ 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:

npm install --save-dev wait-for-federalist
# or with Yarn:
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}.
  1. 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:

machine:
  node:
    version: 4

test:
  override:
    - $(npm bin)/wait-for-federalist > site_url.txt

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

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

wait-for-federalist's People

Contributors

shawnbot avatar

Watchers

 avatar  avatar  avatar

Forkers

isabella232

wait-for-federalist's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.