-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.coventry.ac.uk/web/dynamic-we…
- Loading branch information
Showing
32 changed files
with
777 additions
and
7 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
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
|
||
# DevOps | ||
|
||
In this lab you will learn how to deploy your app to a cloud server and how to set up a complete devops build chain. For this tutorial you will need to have an account on the [GitLab](https://gitlab.com) server as we will be learning how to use the GitLab CI continuous integration tools. (Note that GitHub has recently introduced a rival service called [GitHub Actions](https://github.com/features/actions) however at the time of writing this was still in Beta). | ||
|
||
Create an account using your University email address and log in. Create an empty private repository called devops and make a note of the git clone URL. | ||
|
||
You should now clone the `template-dynamic-website` repository (the original template, not the one you have been using for your assignment) into a temporary location on your computer. | ||
|
||
```shell | ||
git clone https://github.coventry.ac.uk/web/template-dynamic-websites.git temp | ||
``` | ||
|
||
Once cloned you need to _mirror push_ to the empty gitlab repository. | ||
|
||
```shell | ||
cd temp/ && git push --mirror xxx | ||
``` | ||
|
||
## Deploying to the Cloud | ||
|
||
Using Heroku | ||
|
||
## Running a CI Workflow | ||
|
||
Introduction to CI and gitlab Ci | ||
|
||
Committing and pushing to trigger the workflow. |
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
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,5 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
echo hello | ||
mkdir -p screenshots | ||
mkdir -p trace | ||
rm -rf *.db | ||
# [ ! -d "node_modules" ] && echo "INSTALLING MODULES" && npm install | ||
node index.js& | ||
node_modules/.bin/jest --runInBand --detectOpenHandles acceptance\ tests/* | ||
kill %1 | ||
read -p "Press enter to continue" | ||
|
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,8 @@ | ||
|
||
path: | ||
- "/." | ||
languages: | ||
- javascript | ||
exclude: | ||
- "**/node_modules/**" | ||
reporter: json |
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,2 @@ | ||
node_modules/ | ||
docs/ |
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,57 @@ | ||
|
||
{ | ||
"env": { | ||
"es6": true, | ||
"jasmine": true, | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 8 | ||
}, | ||
"rules": { | ||
"arrow-body-style": 2, | ||
"arrow-spacing": [1, { "before": true, "after": true }], | ||
"brace-style": 2, | ||
"camelcase": [2, {"properties": "never"}], | ||
"complexity": [2, {"max": 3}], | ||
"eol-last": 1, | ||
"eqeqeq": 2, | ||
"global-require": 2, | ||
"handle-callback-err": 2, | ||
"indent": [1, "tab", { "SwitchCase": 1 }], | ||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }], | ||
"linebreak-style": [1, "unix"], | ||
"max-depth": ["error", {"max": 4}], | ||
"max-len": ["error", { "code": 80 }], | ||
"max-nested-callbacks": ["error", {"max": 3}], | ||
"max-params": ["error", {"max": 3}], | ||
"max-statements": ["error", {"max": 10}], | ||
"no-cond-assign": 2, | ||
"no-dupe-args": 2, | ||
"no-dupe-keys": 2, | ||
"no-duplicate-case": 2, | ||
"no-empty": 1, | ||
"no-empty-function": 1, | ||
"no-multiple-empty-lines": 1, | ||
"no-extra-parens": 2, | ||
"no-func-assign": 2, | ||
"no-irregular-whitespace": 1, | ||
"no-magic-numbers": [1, { "ignore": [-1, 0, 1, 2] }], | ||
"no-multi-spaces": 1, | ||
"no-multi-str": 1, | ||
"no-unexpected-multiline": 2, | ||
"no-unreachable": 2, | ||
"no-self-assign": 2, | ||
"no-trailing-spaces": 1, | ||
"no-undef": 2, | ||
"no-unused-vars": 1, | ||
"no-var": 2, | ||
"prefer-arrow-callback": 1, | ||
"prefer-const": 2, | ||
"quotes": [1, "single"], | ||
"semi": [1, "never"], | ||
"space-before-function-paren": [1, "never"], | ||
"strict": [2, "global"], | ||
"yoda": 2 | ||
} | ||
} |
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,3 @@ | ||
.DS_Store | ||
node_modules/ | ||
docs/ |
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,80 @@ | ||
image: node:latest | ||
|
||
stages: | ||
- code-testing | ||
- staging-server | ||
- acceptance-testing | ||
|
||
linting: | ||
stage: code-testing | ||
script: | ||
- npm install | ||
- npm run linter | ||
|
||
dependency-checks: | ||
stage: code-testing | ||
script: | ||
- npm install | ||
- npm run dependency | ||
|
||
code-duplication: | ||
stage: code-testing | ||
script: | ||
- npm install | ||
- npm run duplication | ||
|
||
unit-testing: | ||
stage: code-testing | ||
script: | ||
- npm install | ||
- npm test | ||
|
||
code-coverage: | ||
stage: code-testing | ||
script: | ||
- npm install | ||
- npm run coverage | ||
- npm run check-coverage | ||
|
||
coverage-report: | ||
stage: staging-server | ||
script: | ||
- npm install | ||
- npm run coverage | ||
#- mv ./docs/coverage/ public/ | ||
artifacts: | ||
paths: | ||
- docs | ||
expire_in: 30 days | ||
only: | ||
- master | ||
|
||
deploy-staging-server: | ||
stage: staging-server | ||
script: | ||
- apt-get update -qy | ||
- apt-get install -y ruby ruby-dev rubygems-integration | ||
- gem install dpl | ||
- dpl --provider=heroku --app=notes-api-test --api-key=95023c27-5a9d-4250-a3fd-d2e19e0dac02 | ||
only: | ||
- master | ||
|
||
acceptance-tests: | ||
stage: acceptance-testing | ||
script: | ||
- npm install --only=dev | ||
- npm run acceptance | ||
only: | ||
- master | ||
|
||
# https://docs.gitlab.com/ce/ci/examples/test-and-deploy-python-application-to-heroku.html | ||
|
||
# production: | ||
# type: deploy | ||
# script: | ||
# - apt-get update -qy | ||
# - apt-get install -y ruby-dev | ||
# - gem install dpl | ||
# - dpl --provider=heroku --app=gitlab-ci-python-test-prod --api-key=$HEROKU_PRODUCTION_API_KEY | ||
# only: | ||
# - tags |
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,10 @@ | ||
|
||
instrumentation: | ||
excludes: ['*-spec.js', 'spec/*', 'integration/*'] | ||
reporting: | ||
dir: ./docs/coverage/ | ||
watermarks: | ||
statements: [50, 80] | ||
lines: [50, 80] | ||
functions: [50, 80] | ||
branches: [50, 80] |
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,11 @@ | ||
|
||
# Notes | ||
|
||
This code is designed to demonstrate the use of Continuous Integration. | ||
|
||
## Dependencies | ||
``` | ||
npm install | ||
npm install --only=dev | ||
npm install --only=production | ||
``` |
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,21 @@ | ||
|
||
'use strict' | ||
|
||
const frisby = require('frisby') | ||
const status = require('../status-codes.json') | ||
const url = 'https://notes-api-test.herokuapp.com' | ||
console.log(url) | ||
console.log(status.ok) | ||
|
||
it('should be a teapot', done => { | ||
frisby.get('http://httpbin.org/status/200') | ||
.expect('status', status.ok) | ||
.done(done) | ||
}); | ||
|
||
it ('should return a status of 200', done => { | ||
frisby | ||
.get(`${url}/notes`) | ||
.expect('status', status.ok) | ||
.done(done) | ||
}) |
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,6 @@ | ||
|
||
{ | ||
"spec_files": [ | ||
"acceptance/api-spec.js" | ||
] | ||
} |
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,20 @@ | ||
|
||
'use strict' | ||
|
||
const Jasmine = require('jasmine') | ||
const jasmine = new Jasmine() | ||
|
||
jasmine.loadConfigFile('acceptance/jasmine.json') | ||
|
||
const JasmineConsoleReporter = require('jasmine-console-reporter') | ||
const reporter = new JasmineConsoleReporter({ | ||
colors: true, | ||
cleanStack: true, | ||
verbosity: 3, | ||
listStyle: 'indent', | ||
activity: true | ||
}) | ||
|
||
jasmine.addReporter(reporter) | ||
|
||
jasmine.execute() |
Oops, something went wrong.