Skip to content
This repository has been archived by the owner on Sep 4, 2022. It is now read-only.

Commit

Permalink
modified test approach and push to dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
andriimykytyn committed Mar 29, 2020
1 parent e989f6e commit a825e8d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 20 deletions.
22 changes: 6 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,17 @@ branches:
- master

before_install:
- docker build -t andriimykytyn/web .
- docker build -t speech4j/web-test -f Dockerfile.dev .

before_script:
- npm install -g --silent @angular/[email protected]

script:
- ng lint
- npm run test-headless
- docker run -e CI=true speech4j/web-test -v "$(pwd)"/coverage:/web/coverage/web 55e79f84f759 npm run test-headless
- sonar-scanner -Dsonar.verbose=true -X
- npm run build

deploy:
provider: pages
skip_cleanup: true
github_token: "$GITHUB_TOKEN"
keep_history: true
local_dir: dist/web
on:
branch: master

notifications:
email:
on_failure: change
on_success: change
after_success:
- docker build -t speech4j/web-prod .
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
- docker push speech4j/web-prod
10 changes: 10 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM docker.io/node:12-stretch
WORKDIR '/web'
COPY package.json .
RUN npm install
COPY . .
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends chromium
ENV CHROME_BIN=chromium
CMD ["npm","run","start"]
19 changes: 17 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
version: '3'
services:
web:
build: .
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "4200:80"
- "4200:4200"
volumes:
- /web/node_modules
- .:/web
tests:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- /web/node_modules
- .:/web
command: ["npm","run","test-headless"]
web-prod:
build: .
volumes:
- /web/node_modules
- .:/web
8 changes: 7 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ module.exports = function (config) {
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: false,
restartOnFileChange: true
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "ng build --prod",
"lint": "ng lint",
"e2e": "ng e2e",
"test-headless": "ng test --watch=false --browsers=ChromeHeadless --code-coverage"
"test-headless": "ng test --watch=false --code-coverage"
},
"private": "true",
"dependencies": {
Expand Down

0 comments on commit a825e8d

Please sign in to comment.