A utility to wait for Federalist builds before running CI tests
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.
You can install it with npm or Yarn:
npm install --save-dev wait-for-federalist
# or with Yarn:
yarn add wait-for-federalist
The wait-for-federalist
CLI performns the following steps:
master
, the base URL is https://federalist-proxy.app.cloud.gov/site/{owner}/{name}
.https://federalist.fr.cloud.gov/preview/{owner}/{name}/{branch}
.{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.
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)