docs(readme): Updated documentation on how to run and release the application

This commit is contained in:
Erik Tiekstra
2021-05-18 10:59:56 +02:00
parent 2b4dc1a38c
commit 482357b118
2 changed files with 61 additions and 14 deletions

View File

@@ -10,7 +10,11 @@ To get started, clone the repository and run `npm install` in the root of the pr
### Development server DAFA-web ### Development server DAFA-web
Run `npm run start:dafa` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. Run `npm start` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
#### Pega
Run `npm run start:pega` to run against the Pega API.
### Generate an application ### Generate an application
@@ -26,17 +30,21 @@ Run `npm run new-component my-component --project=my-app` to generate a new comp
### Build DAFA-web ### Build DAFA-web
Run `npm run build:dafa` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
#### Pega
Run `npm run build:pega` to build the project using the Pega API.
### Running unit tests on DAFA-web ### Running unit tests on DAFA-web
Run `npm run test:dafa` to execute the unit tests via [Jest](https://jestjs.io). Run `npm run test` to execute the unit tests via [Jest](https://jestjs.io).
Run `npm run nx affected:test` to execute the unit tests affected by a change. Run `npm run nx affected:test` to execute the unit tests affected by a change.
### Running end-to-end tests on DAFA-web ### Running end-to-end tests on DAFA-web
Run `npm run e2e:dafa` to execute the end-to-end tests via [Cypress](https://www.cypress.io). Run `npm run e2e` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
Run `npm run nx affected:e2e` to execute the end-to-end tests affected by a change. Run `npm run nx affected:e2e` to execute the end-to-end tests affected by a change.
@@ -44,9 +52,52 @@ Run `npm run nx affected:e2e` to execute the end-to-end tests affected by a chan
Run `npm run nx dep-graph` to see a diagram of the dependencies of your projects. Run `npm run nx dep-graph` to see a diagram of the dependencies of your projects.
## ## Git workflow
Using the mock-api - Use branching model [Gitflow](http://nvie.com/posts/a-successful-git-branching-model/).
- Example: `feature/TV-XXXX` or `bugfix/TV-XXXX`
- A useful CLI helper tool can be used: [gitflow-avh](https://github.com/petervanderdoes/gitflow-avh).
- Clone origin, create feature/bugfix branches and push back to origin.
- Don't forget to commit and push your changes regulary!
- Create a pull request for each feature branch.
- When merging the pull request, follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) structure inside the merge message.
- The merge-message, which follows conventional commits, will be added to the CHANGELOG after a release is made.
- A commit message could look like this: `feat(startpage): Added headings and description to the startpage (TV-1234)`.
- The changelog would look something like this:
```md
### Features
- **startpage:** Added headings and description to the startpage ([TV-1234](https://jira.arbetsformedlingen.se/browse/TV-1234)) ([commit-hash](https://bitbucket.arbetsformedlingen.se/projects/tea/repos/dafa-web-monorepo/commits/commit-hash))
```
- Upon merge, Open Shift will deploy the application to [AUTO](http://mina-sidor-fa-auto.tocp.arbetsformedlingen.se) and [TEST](http://mina-sidor-fa-test.tocp.arbetsformedlingen.se).
## Release and deploy
We use a semi-automated release and deploy to different test-enviroments. A release script is used in combination with [semantic-release](https://semantic-release.gitbook.io/semantic-release/) to add the correct version of the application and changes to the changelog. The deployments are made depending on which branches are updated:
- `develop` is automatically deployed to [AUTO](http://mina-sidor-fa-auto.tocp.arbetsformedlingen.se) and [TEST](http://mina-sidor-fa-test.tocp.arbetsformedlingen.se).
- `next` is automatically deployed to [SYS](http://mina-sidor-fa-sys.tocp.arbetsformedlingen.se).
- `main` is automatically deployed to [ACC](http://mina-sidor-fa-acc.tocp.arbetsformedlingen.se). After this is completed, a question needs to be answered whether the image should be deployed to PROD.
### Deploy to SYS
To deploy the application to SYS you need to create a release. Make sure you are in the `develop` branch and are up-to-date with origin. Then run `npm run release`. This will:
- Update the [CHANGELOG.md](CHANGELOG.md).
- Bump the applications version according to semantic versioning.
- Commits the CHANGELOG to `develop` and pushes it to origin.
- Merge `develop` into `next` and pushes `next` to origin.
Open Shift will deploy the application to [SYS](http://mina-sidor-fa-sys.tocp.arbetsformedlingen.se).
### Release to ACC and PROD
To release the latest version of `next` to ACC and eventually to PROD; a pull request should be created to merge `next` into `main`. The `next` branch is protected and will not be deleted upon merge.
Open Shift will deploy the application to [ACC](http://mina-sidor-fa-acc.tocp.arbetsformedlingen.se) and a question inside the pipeline is asked if the application also should be deployed to PROD. This question will persist for 24 hours.
## General Nx documentation ## General Nx documentation

View File

@@ -10,19 +10,15 @@
"ng": "nx", "ng": "nx",
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
"nx": "nx", "nx": "nx",
"start": "ng serve", "start": "ng serve dafa-web",
"start:dafa": "ng serve dafa-web",
"start:pega": "ng serve dafa-web --configuration pega", "start:pega": "ng serve dafa-web --configuration pega",
"build": "ng build", "build": "ng build dafa-web",
"build:dafa": "ng build dafa-web",
"build:pega": "ng build dafa-web --configuration pega", "build:pega": "ng build dafa-web --configuration pega",
"test": "ng test", "test": "ng test dafa-web",
"test:dafa": "ng test dafa-web",
"release": "bash ./tools/release.sh", "release": "bash ./tools/release.sh",
"release:dry": "bash ./tools/release.sh dry", "release:dry": "bash ./tools/release.sh dry",
"lint": "nx workspace-lint && ng lint", "lint": "nx workspace-lint && ng lint",
"e2e": "ng e2e", "e2e": "ng e2e dafa-web",
"e2e:dafa": "ng e2e dafa-web",
"affected:apps": "nx affected:apps", "affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs", "affected:libs": "nx affected:libs",
"affected:build": "nx affected:build", "affected:build": "nx affected:build",