Skip to content

Commit

Permalink
Storybook fix (#25)
Browse files Browse the repository at this point in the history
* storybook fix

* update test.yml file

* cd to angular path in test.yml

* temporary remove npm install step

* revert

* use npmrc secret

* use npmrc secret

* change working directory before add npmrc

* add env

* change on step

* use pull reqeust target

* modify on:

* add on pull_request

* Use Different Concurrency Groups:

* get rid of concurrency temp

* use pull request yml to run both jobs

* use pull request yml to run both jobs

* use pull request yml to run both jobs

* use pull request yml to run both jobs

* try the on push for test.yml

* revert
  • Loading branch information
yzlucas authored Sep 17, 2024
1 parent 098d4e8 commit 61b705a
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 373 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/sonarscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ env:
on:
pull_request_target:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number}}
cancel-in-progress: true

jobs:
build:
name: Build and analyze
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run Tests

env:
NPMRC: ${{ secrets.NPMRC }}

on:
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Change directory to Angular app
run: cd client/wfprev-war/src/main/angular

# Use the NPMRC secret to set up npm authentication
- name: Add .npmrc file
run: echo -e $NPMRC > ~/.npmrc

# Install dependencies
- run: npm install
working-directory: client/wfprev-war/src/main/angular

# Run unit tests and generate code coverage
- run: npm run test -- --watch=false --code-coverage

# Ensure coverage meets the required threshold
- name: Check code coverage
run: |
if grep -q '"statements": 8[0-9]' ../../client/wfprev-war/src/main/angular/coverage/wfprev/coverage-summary.json; then
echo "Test passed";
else
echo "Code coverage is less than 80%! Exiting...";
exit 1;
2 changes: 1 addition & 1 deletion client/wfprev-war/src/main/angular/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Thumbs.db
*storybook.log

# Documentation.json
.documentation.json
documentation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"resolveJsonModule": true
},
"exclude": ["../src/test.ts", "../src/**/*.spec.ts"],
"include": ["../src/**/*.stories.*", "./preview.ts"],
"include": ["../src/**/*.stories.*", "./preview.ts", "../src/polyfills.ts"],
"files": ["./typings.d.ts"]
}
Loading

0 comments on commit 61b705a

Please sign in to comment.