diff --git a/.travis.yml b/.travis.yml index e022f010..ac0a4837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty language: node_js node_js: - lts/* @@ -12,9 +13,15 @@ env: - DECISION="https://lists.w3.org/Archives/Public/public-webapps/2014JulSep/0627.html" - secure: "vuLLjmy5cSalvR4ut2Q28YJgVUoSmLQYlhNRyF7zVskO5VFX7RHpfWokrk1SXEQ5hI8bpWOYJOVrcYr05BP0cFvsESlDejaur4rw/gT2nfMkuyWbVhbxH9mFYKeVFWpoC+iezrao9VjMRYySjEJAM4B9mXflN3MQ6ddRaQlBMaI=" +install: + - npm install respec-validator + script: - - npm install respec serve - - node ./tools/validate.js + - npx respec-validator --no-links --gh-user=$GH_USER --gh-token=$GH_TOKEN index.html + +cache: + directories: + - node_modules after_success: - CC="mcaceres@mozilla.com,mgiuca@google.com" diff --git a/tools/validate.js b/tools/validate.js deleted file mode 100644 index a2c3bf21..00000000 --- a/tools/validate.js +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env node -/*eslint-env node*/ -"use strict"; -const { exec } = require("child_process"); -const handler = require("serve-handler"); -const http = require("http"); - -/** - * - * @param {string} cmd A string representing a shell command. - */ -class ShellCommand { - constructor(cmd) { - this._cmd = cmd; - } - get cmd() { - return this._cmd; - } - run() { - return new Promise((resolve, reject) => { - const childProcess = exec(this.cmd, (err, data) => { - if (err) { - return reject(err); - } - resolve(data); - }); - childProcess.stdout.pipe(process.stdout); - childProcess.stderr.pipe(process.stderr); - }); - } -} - -/** - * Spins up a local HTTP server and checks the spec. - * If there are any errors or warnings, the app exits with 1. - */ -async function validate() { - const server = http.createServer((request, response) => - handler(request, response) - ); - server.listen(5000, () => {}); - const url = `http://localhost:5000/index.html?githubToken=${ - // This "AUTHENTICATE" is a GitHub token https://github.com/settings/tokens - // It needs to be set set on TravisCI itself, via the in the settings - // or using Travis' encrypt. - process.env.AUTHENTICATE - }`; - // -e is stop on errors, -w is stop on warnings - const cmd = `npx respec2html -e -w --timeout 30 --src ${url} --out /dev/null`; - try { - await new ShellCommand(cmd).run(); - } catch (err) { - process.exit(1); - } - process.exit(0); -} - -validate();