Skip to content

Commit 1e5bc3e

Browse files
committed
1 parent 28d55d4 commit 1e5bc3e

File tree

13 files changed

+1920
-26
lines changed

13 files changed

+1920
-26
lines changed

.github/workflows/CD-time-tracker-ui.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,11 @@ jobs:
3333
BASE_PATH: "src/environments/"
3434
run: |
3535
import os
36-
import json
37-
data = {}
3836
base_path = os.environ.get('BASE_PATH', 'src/environments/')
39-
with open(base_path + "keys.example.json", "r+") as jsonFileRead:
40-
data = json.load(jsonFileRead)
41-
data["scopes"] = str(os.environ['SCOPES']).split(",")
42-
data["client_id"] = os.environ['CLIENT_ID']
43-
data["authority"] = os.environ['AUTHORITY']
44-
with open(base_path + ".keys.json", "w+") as jsonFileWrite:
45-
json.dump(data, jsonFileWrite)
37+
with open(base_path + "keys.ts", "w") as fileWithKeys:
38+
fileWithKeys.write('export const AUTHORITY = ') + str(os.environ['SCOPES']).split(",") + ';';
39+
fileWithKeys.write('\nexport const CLIENT_ID = ' + os.environ['CLIENT_ID']) + ';';
40+
fileWithKeys.write('\nexport const SCOPES = ' + os.environ['AUTHORITY']) + ';';
4641
4742
- name: 'run: npm install and build'
4843
run: |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Running mutation tests
2+
3+
on:
4+
schedule:
5+
- cron: '* 13 * * 1'
6+
branches:
7+
- master
8+
9+
jobs:
10+
configuring-stryker:
11+
name: Running stryker
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 360
14+
steps:
15+
- name: Clone and checkout branch
16+
uses: actions/checkout@master
17+
18+
- name: Set up Node.js version
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: '12.x'
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: Inject Secrets
27+
env:
28+
SCOPES: ${{ secrets.scopes }}
29+
CLIENT_ID: ${{ secrets.client_id }}
30+
AUTHORITY: ${{ secrets.authority }}
31+
run: sudo sh scripts/populate-keys.sh
32+
33+
- name: Run the test
34+
run: npm run ci-test --if-present
35+
36+
- name: Installing stryker-cli
37+
run: npm install -g stryker-cli
38+
39+
- name: Running stryker
40+
run: stryker run

.github/workflows/CI-time-tracker-ui.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,14 @@ jobs:
4848
BASE_PATH: "src/environments/"
4949
run: |
5050
import os
51-
import json
52-
data = {}
5351
base_path = os.environ.get('BASE_PATH', 'src/environments/')
54-
with open(base_path + "keys.example.json", "r+") as jsonFileRead:
55-
data = json.load(jsonFileRead)
56-
data["scopes"] = str(os.environ['SCOPES']).split(",")
57-
data["client_id"] = os.environ['CLIENT_ID']
58-
data["authority"] = os.environ['AUTHORITY']
59-
with open(base_path + ".keys.json", "w+") as jsonFileWrite:
60-
json.dump(data, jsonFileWrite)
52+
with open(base_path + "keys.ts", "w") as fileWithKeys:
53+
scopes = str(os.environ['SCOPES']).split(",")
54+
client_id = os.environ['CLIENT_ID']
55+
authority = os.environ['AUTHORITY']
56+
fileWithKeys.write(f'export const SCOPES = {scopes};')
57+
fileWithKeys.write(f'\nexport const CLIENT_ID = {client_id};')
58+
fileWithKeys.write(f'\nexport const AUTHORITY = {authority};')
6159
6260
- name: Run the test
6361
run: npm run ci-test --if-present

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ yarn-error.log
4141
testem.log
4242
/typings
4343
.keys.json
44+
**keys.ts
45+
src/environments/keys.ts
46+
4447
# System Files
4548
.DS_Store
4649
Thumbs.db
50+
51+
# stryker temp files
52+
.stryker-tmp

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ Run `ng build` to build the project. The build artifacts will be stored in the `
4848

4949
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
5050

51+
## Running mutation tests
52+
Mutation tests have been enabled using stryker. You can run those tests locally, it takes ~4 hours to have the results. If you want to run them locally please install stryker locally:
53+
```
54+
npm install -g stryker-cli
55+
```
56+
57+
Now, run stryker:
58+
```
59+
stryker run
60+
```
61+
62+
Stryker is also executed on GitHub actions with the following cron expresion:
63+
64+
5165
## Running end-to-end tests
5266

5367
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

0 commit comments

Comments
 (0)