Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(monorepo): Update CI config for oauth-server import.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed Oct 24, 2018
1 parent 90e6df2 commit 6a5675c
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 162 deletions.
75 changes: 75 additions & 0 deletions .circleci/config.yml
Expand Up @@ -66,6 +66,76 @@ jobs:
docker push ${DOCKERHUB_REPO}:${DOCKER_TAG}
fi
build-oauth:
docker:
- image: circleci/node

steps:
- checkout
- setup_remote_docker

- run:
name: Create version.json
command: >
printf '{"version":{"hash":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}}\n'
"$CIRCLE_SHA1"
"$CIRCLE_TAG"
"$CIRCLE_PROJECT_USERNAME"
"fxa-oauth-server"
"$CIRCLE_BUILD_URL"
| tee fxa-oauth-server/config/version.json fxa-oauth-server/version.json
- store_artifacts:
path: version.json

- run:
name: Build deployment container image
command: cd fxa-oauth-server && docker build -f Dockerfile-build -t fxa-oauth-server:build .

- run:
name: Check npm install
command: cd fxa-oauth-server && docker run --rm -it fxa-oauth-server:build npm ls --production

- run:
name: Build test container image
command: cd fxa-oauth-server && docker build -f Dockerfile-test -t fxa-oauth-server:test .

- run:
name: Run MySQL
command: docker run -d --name=mydb -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_ROOT_HOST=% -p 3306:3306 mysql/mysql-server:5.6
background: true

- run:
name: Run Memory DB Tests
command: cd fxa-oauth-server && docker run fxa-oauth-server:test npm test

- run:
name: Run MySQL DB Tests
command: cd fxa-oauth-server && docker run --net=host -p 3306:3306 -e DB="mysql" fxa-oauth-server:test npm test

- run:
name: Push to Dockerhub
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
DOCKER_TAG="latest"
fi
if [[ "${CIRCLE_BRANCH}" == feature* ]] || [[ "${CIRCLE_BRANCH}" == dockerpush* ]]; then
DOCKER_TAG="${CIRCLE_BRANCH}"
fi
if [ -n "${CIRCLE_TAG}" ]; then
DOCKER_TAG="$CIRCLE_TAG"
fi
if [ -n "${DOCKER_TAG}" ]; then
echo "$DOCKER_OAUTH_PASS" | docker login -u "$DOCKER_OAUTH_USER" --password-stdin
echo ${DOCKERHUB_OAUTH_REPO}:${DOCKER_TAG}
docker tag fxa-oauth-server:build ${DOCKERHUB_OAUTH_REPO}:${DOCKER_TAG}
docker images
docker push ${DOCKERHUB_OAUTH_REPO}:${DOCKER_TAG}
fi
workflows:
version: 2

Expand All @@ -83,3 +153,8 @@ workflows:
filters:
tags:
only: /.*/

- build-oauth:
filters:
tags:
only: /.*/
1 change: 1 addition & 0 deletions .dockerignore
@@ -1 +1,2 @@
.git
fxa-oauth-server
74 changes: 54 additions & 20 deletions .travis.yml
Expand Up @@ -4,6 +4,7 @@ node_js:
- "8"

dist: trusty
sudo: true

services:
- redis-server
Expand All @@ -13,15 +14,11 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6

env:
matrix:
- DB=memory
- DB=mysql

notifications:
email:
- rfkelly@mozilla.com
Expand All @@ -32,19 +29,56 @@ notifications:
use_notice: false
skip_join: false

before_install:
- npm i -g npm@6
- npm config set spin false

install:
- npm ci
_aliases:
- &test
before_install:
- npm i -g npm@6
- npm config set spin false
- &fxa-auth-memory-test
env: DB=memory
<<: *test
- &fxa-auth-mysql-test
env: DB=mysql
<<: *test
- &fxa-oauth-memory-test
env: CXX=g++-4.8 NODE_ENV=test DB=memory
<<: *test
- &fxa-oauth-mysql-test
env: CXX=g++-4.8 NODE_ENV=test DB=mysql
<<: *test

script:
- if [ $DB == "mysql" ]; then ./scripts/start-travis-auth-db-mysql.sh; fi
- npm run test-ci
- npm run test-e2e
- npm run test-scripts
# Test fxa-auth-mailer
- grunt templates && git status -s | (! grep 'M lib/senders/templates/')
- grunt l10n-extract
- npm run lint:deps
jobs:
include:
- stage:
node_js: 8
<<: *fxa-auth-memory-test
install:
- npm ci
script:
- npm run test-ci
- npm run test-e2e
- npm run test-scripts
- grunt templates && git status -s | (! grep 'M lib/senders/templates/')
- grunt l10n-extract
- npm run lint:deps
- stage:
node_js: 8
<<: *fxa-auth-mysql-test
install:
- npm ci
script:
- ./scripts/start-travis-auth-db-mysql.sh
- npm run test-ci
- npm run test-e2e
- stage:
node_js: 8
<<: *fxa-oauth-memory-test
install:
- cd fxa-oauth-server && npm ci && cd ..
script: cd fxa-oauth-server && npm test
- stage:
node_js: 8
<<: *fxa-oauth-memory-test
install:
- cd fxa-oauth-server && npm ci && cd ..
script: cd fxa-oauth-server && npm test
95 changes: 0 additions & 95 deletions fxa-oauth-server/.circleci/config.yml

This file was deleted.

46 changes: 0 additions & 46 deletions fxa-oauth-server/.travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion fxa-oauth-server/lib/routes/root.js
Expand Up @@ -34,7 +34,7 @@ module.exports = {
function runGitCmd() {
return new Promise((resolve) => {
// figure it out from .git
var gitDir = path.resolve(__dirname, '..', '..', '.git');
var gitDir = path.resolve(__dirname, '..', '..', '..', '.git');
exec('git rev-parse HEAD', { cwd: gitDir }, function(err, stdout) {
commitHash = stdout.replace(/\s+/, '');
var configPath = path.join(gitDir, 'config');
Expand Down

0 comments on commit 6a5675c

Please sign in to comment.