Skip to content

Commit 52a706a

Browse files
committedMar 17, 2024
gitlab ci-cd added with auto deployment to vercel
1 parent 8fd8d09 commit 52a706a

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed
 

‎.gitlab-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
image: node:latest
2+
3+
cache:
4+
key: ${CI_COMMIT_REF_SLUG}
5+
paths:
6+
- node_modules/
7+
- /usr/local/lib/node_modules/@angular/cli/
8+
9+
stages:
10+
- build
11+
- test
12+
- deploy
13+
14+
build:
15+
stage: build
16+
script:
17+
- npm install -g @angular/cli
18+
- npm install
19+
- ng build --configuration=production
20+
21+
test:
22+
stage: test
23+
before_script:
24+
- apt-get update
25+
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
26+
- apt install -y ./google-chrome*.deb;
27+
- export CHROME_BIN=/usr/bin/google-chrome
28+
script:
29+
- npm ci
30+
- npm run test -- --no-watch --browsers=ChromeHeadlessCI
31+
32+
deploy:
33+
stage: deploy
34+
script:
35+
- npm install -g vercel
36+
- vercel --prod --token $VERCEL_TOKEN --yes
37+
only:
38+
- master

‎angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
"styles": [
9696
"src/styles.scss"
9797
],
98-
"scripts": []
98+
"scripts": [],
99+
"karmaConfig": "karma.conf.js"
99100
}
100101
}
101102
}

‎karma.conf.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/frontend'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
browsers: ['Chrome', "ChromeHeadlessCI"],
37+
restartOnFileChange: true,
38+
customLaunchers: {
39+
ChromeHeadlessCI: {
40+
base: 'ChromeHeadless',
41+
flags: ['--no-sandbox']
42+
}
43+
}
44+
});
45+
};

0 commit comments

Comments
 (0)
Please sign in to comment.