Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25a9eab
commit bf66c5e
Showing
5 changed files
with
117 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
sudo: false | ||
sudo: true | ||
services: | ||
- docker | ||
cache: | ||
directories: | ||
- node_modules | ||
notifications: | ||
email: true | ||
language: node_js | ||
node_js: | ||
- '6' | ||
- '10' | ||
# before_install: | ||
# - npm i -g npm@^2.0.0 | ||
before_script: | ||
- npm prune | ||
- 'curl -Lo travis_after_all.py https://git.io/vLSON' | ||
after_success: | ||
- python travis_after_all.py | ||
- export $(cat .to_export_back) | ||
- npm run docs | ||
- git config --global user.name "Adam Powers" | ||
- git config --global user.email "apowers@ato.ms" | ||
- npm run publish | ||
- npm run docker:build:prod-canary | ||
- npm run docker:build:test-canary | ||
script: | ||
- docker run docker:test:canary | ||
deploy: | ||
provider: script | ||
script: | ||
- npm run docker:login | ||
- npm run docker:release:canary | ||
on: | ||
branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# production app | ||
FROM node:10 as production | ||
LABEL maintainer="apowers@ato.ms" | ||
WORKDIR /usr/src/app | ||
COPY package.json scm-config.json /usr/src/app/ | ||
COPY webauthn-yubiclone/ /usr/src/app/webauthn-yubiclone/ | ||
# RUN npm install --only=production | ||
RUN npm install | ||
EXPOSE 8888 | ||
EXPOSE 8443 | ||
ENTRYPOINT ["npm", "start"] | ||
|
||
# dev / testing | ||
FROM node:10 as test | ||
LABEL maintainer="apowers@ato.ms" | ||
WORKDIR /usr/src/app | ||
COPY --from=production /usr/src/app/ /usr/src/app/ | ||
COPY test/ /usr/src/app/test/ | ||
# RUN npm install --only=development | ||
EXPOSE 8888 | ||
EXPOSE 8443 | ||
ENTRYPOINT ["npm", "test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,61 @@ | ||
var main = require ("../index.js"); | ||
var assert = require ("chai").assert; | ||
"use strict"; | ||
|
||
const assert = require("chai").assert; | ||
const pkg = require("../package"); | ||
const path = require("path"); | ||
const { spawn } = require("child_process"); | ||
const nodeModulesDir = path.join(__dirname, "../node_modules"); | ||
|
||
describe ("main test", function() { | ||
it("tests something", function() { | ||
function testPackage(pkgName) { | ||
it(`tests ${pkgName}`, async function() { | ||
this.timeout(300000); // eslint-disable-line no-invalid-this | ||
this.slow(300000); // eslint-disable-line no-invalid-this | ||
|
||
var pkgDir = path.join(nodeModulesDir, pkgName); | ||
console.log("pkgDir", pkgDir); | ||
// XXX: no guarantee that the devDependencies were installed unless we 'install' first | ||
await npmCmd(pkgDir, "install"); | ||
await npmCmd(pkgDir, "test"); | ||
}); | ||
} | ||
|
||
async function npmCmd(pkgDir, cmd) { | ||
// spawn npm to test | ||
var npmArgs = []; | ||
npmArgs.push(cmd); | ||
|
||
// spawn npm | ||
var npmPs = spawn("npm", npmArgs, { | ||
cwd: pkgDir | ||
}); | ||
|
||
npmPs.stdout.on("data", (data) => { | ||
process.stdout.write(data.toString()); | ||
}); | ||
|
||
npmPs.stderr.on("data", (data) => { | ||
process.stderr.write(data.toString()); | ||
}); | ||
|
||
return new Promise((resolve, reject) => { | ||
npmPs.on("close", (code) => { | ||
// console.log("npm finished with code:", code); | ||
if (code === 0) { | ||
return resolve(true); | ||
} | ||
reject(new Error("test failed with code: " + code)); | ||
}); | ||
}); | ||
} | ||
|
||
describe("fido-server-demo", function() { | ||
it("loaded pkg", function() { | ||
// test goes here | ||
assert (true); | ||
assert.isObject(pkg); | ||
}); | ||
}); | ||
|
||
// test all packages | ||
for (let depPkg of Object.keys(pkg.dependencies)) { | ||
testPackage(depPkg); | ||
} | ||
}); |