Skip to content

Commit 036164f

Browse files
UIREQMED-1: New app created with stripes-cli. Updated module after created with stripes-cli.
1 parent 2cb647e commit 036164f

34 files changed

+399
-611
lines changed

.eslintrc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"extends": "@folio/eslint-config-stripes",
32
"parser": "@babel/eslint-parser",
3+
"extends": "@folio/eslint-config-stripes",
44
"overrides": [
55
{
66
"files": [ "src/**/tests/*", "**/*.test.js", "test/**/*" ],
@@ -12,5 +12,16 @@
1212
],
1313
"env": {
1414
"jest": true
15+
},
16+
"settings": {
17+
"import/resolver": {
18+
"alias": {
19+
"map": [
20+
["__mock__", "./test/jest/__mock__"],
21+
["fixtures", "./test/jest/fixtures"],
22+
["helpers", "./test/jest/helpers"]
23+
]
24+
}
25+
}
1526
}
1627
}

.github/workflows/build-npm-release.yml

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# This workflow will do a clean install of node dependencies, build the source code,
2-
# run unit tests, and perform a SonarCloud scan ONLY on a `release`.
2+
# run unit tests, perform a SonarCloud scan and publish NPM package ONLY on a tagged release.
33

44
# For more information see:
55
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
66

77
# Common FOLIO configurable env:
88
# - YARN_TEST_OPTIONS (options to pass to 'yarn test')
9-
# - SQ_ROOT_DIR (where to scan relative to top-level directory)
10-
# - FOLIO_NAME
9+
# - SQ_ROOT_DIR (root SQ directory to scan relative to top-level directory)
1110
# - PUBLISH_MOD_DESCRIPTOR (boolean 'true' or 'false')
1211
# - COMPILE_TRANSLATION_FILES (boolean 'true' or 'false')
1312

14-
15-
1613
name: buildNPM Release
1714
on:
1815
push:
@@ -21,26 +18,28 @@ on:
2118
workflow_dispatch:
2219

2320
jobs:
24-
build-npm-release:
21+
github-actions-ci:
2522
if : ${{ startsWith(github.ref, 'refs/tags/v') }}
2623
env:
27-
YARN_TEST_OPTIONS: '--ci --coverage --colors'
24+
YARN_TEST_OPTIONS: ''
2825
SQ_ROOT_DIR: './src'
29-
PUBLISH_MOD_DESCRIPTOR: 'false'
30-
COMPILE_TRANSLATION_FILES: 'false'
26+
COMPILE_TRANSLATION_FILES: 'true'
27+
PUBLISH_MOD_DESCRIPTOR: 'true'
3128
FOLIO_NPM_REGISTRY: 'https://repository.folio.org/repository/npm-folio/'
3229
FOLIO_NPM_REGISTRY_AUTH: '//repository.folio.org/repository/npm-folio/'
3330
FOLIO_MD_REGISTRY: 'https://folio-registry.dev.folio.org'
3431
NODEJS_VERSION: '18'
3532
JEST_JUNIT_OUTPUT_DIR: 'artifacts/jest-junit'
3633
JEST_COVERAGE_REPORT_DIR: 'artifacts/coverage-jest/lcov-report/'
34+
BIGTEST_JUNIT_OUTPUT_DIR: 'artifacts/runTest'
35+
BIGTEST_COVERAGE_REPORT_DIR: 'artifacts/coverage/lcov-report/'
3736
OKAPI_PULL: '{ "urls" : [ "https://folio-registry.dev.folio.org" ] }'
3837
SQ_LCOV_REPORT: 'artifacts/coverage-jest/lcov.info'
3938
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/resources/bigtest/interactors/**,**/resources/bigtest/network/**,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'
4039

4140
runs-on: ubuntu-latest
4241
steps:
43-
- uses: actions/checkout@v2
42+
- uses: folio-org/checkout@v2
4443
with:
4544
fetch-depth: 0
4645

@@ -88,12 +87,8 @@ jobs:
8887
run: yarn lint
8988
continue-on-error: true
9089

91-
- name: Get number of CPU cores
92-
id: cpu-cores
93-
uses: SimenB/github-actions-cpu-cores@v1
94-
9590
- name: Run yarn test
96-
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS --max-workers ${{ steps.cpu-cores.outputs.count }}
91+
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS
9792

9893
- name: Run yarn formatjs-compile
9994
if : ${{ env.COMPILE_TRANSLATION_FILES == 'true' }}
@@ -146,20 +141,15 @@ jobs:
146141
customHeaders: '{ "Accept": "application/json; charset=utf-8" }'
147142
data: ${{ steps.moduleDescriptor.outputs.content }}
148143

149-
- name: Upload event file
150-
uses: actions/upload-artifact@v3
151-
with:
152-
name: Event File
153-
path: ${{ github.event_path }}
154-
retention-days: 30
155-
156-
- name: Upload Jest results
144+
- name: Publish Jest unit test results
145+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
157146
if: always()
158-
uses: actions/upload-artifact@v3
159147
with:
160-
name: jest-test-results
161-
path: ${{ env.JEST_JUNIT_OUTPUT_DIR }}/*.xml
162-
retention-days: 30
148+
github_token: ${{ github.token }}
149+
files: "${{ env.JEST_JUNIT_OUTPUT_DIR }}/*.xml"
150+
check_name: Jest Unit Test Results
151+
comment_mode: update last
152+
comment_title: Jest Unit Test Statistics
163153

164154
- name: Publish Jest coverage report
165155
uses: actions/upload-artifact@v2
@@ -169,6 +159,32 @@ jobs:
169159
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
170160
retention-days: 30
171161

162+
- name: Publish BigTest unit test results
163+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
164+
if: always()
165+
with:
166+
github_token: ${{ github.token }}
167+
files: "${{ env.BIGTEST_JUNIT_OUTPUT_DIR }}/*.xml"
168+
check_name: BigTest Unit Test Results
169+
comment_mode: update last
170+
comment_title: BigTest Unit Test Statistics
171+
172+
- name: Publish BigTest coverage report
173+
uses: actions/upload-artifact@v2
174+
if: always()
175+
with:
176+
name: bigtest-coverage-report
177+
path: ${{ env.BIGTEST_COVERAGE_REPORT_DIR }}
178+
retention-days: 30
179+
180+
- name: Publish yarn.lock
181+
uses: actions/upload-artifact@v2
182+
if: failure()
183+
with:
184+
name: yarn.lock
185+
path: yarn.lock
186+
retention-days: 5
187+
172188
- name: Set default branch as env variable
173189
run: echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV
174190

.github/workflows/build-npm.yml

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
# This workflow will do a clean install of node dependencies, build the source code,
2-
# run unit tests, and perform a SonarCloud scan.
2+
# run unit tests, perform a Sonarqube scan, and publish NPM artifacts from master/main.
33

44
# For more information see:
55
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
66

7-
# Common FOLIO configurable env:
7+
# Common FOLIO configurable environment variables to set:
88
# - YARN_TEST_OPTIONS (options to pass to 'yarn test')
9-
# - SQ_ROOT_DIR (where to scan relative to top-level directory)
10-
# - FOLIO_NAME
9+
# - SQ_ROOT_DIR (root SQ directory to scan relative to top-level directory)
1110
# - PUBLISH_MOD_DESCRIPTOR (boolean 'true' or 'false')
1211
# - COMPILE_TRANSLATION_FILES (boolean 'true' or 'false')
1312

1413

1514

1615
name: buildNPM Snapshot
1716
on: [push, pull_request]
17+
1818
jobs:
19-
build-npm:
19+
github-actions-ci:
2020
env:
21-
YARN_TEST_OPTIONS: '--ci --coverage --colors'
21+
YARN_TEST_OPTIONS: ''
2222
SQ_ROOT_DIR: './src'
23-
PUBLISH_MOD_DESCRIPTOR: 'false'
24-
COMPILE_TRANSLATION_FILES: 'false'
23+
COMPILE_TRANSLATION_FILES: 'true'
24+
PUBLISH_MOD_DESCRIPTOR: 'true'
2525
FOLIO_NPM_REGISTRY: 'https://repository.folio.org/repository/npm-folioci/'
2626
FOLIO_NPM_REGISTRY_AUTH: '//repository.folio.org/repository/npm-folioci/'
2727
FOLIO_MD_REGISTRY: 'https://folio-registry.dev.folio.org'
2828
NODEJS_VERSION: '18'
2929
JEST_JUNIT_OUTPUT_DIR: 'artifacts/jest-junit'
3030
JEST_COVERAGE_REPORT_DIR: 'artifacts/coverage-jest/lcov-report/'
31+
BIGTEST_JUNIT_OUTPUT_DIR: 'artifacts/runTest'
32+
BIGTEST_COVERAGE_REPORT_DIR: 'artifacts/coverage/lcov-report/'
3133
SQ_LCOV_REPORT: 'artifacts/coverage-jest/lcov.info'
3234
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/resources/bigtest/interactors/**,**/resources/bigtest/network/**,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'
3335

3436
runs-on: ubuntu-latest
3537
steps:
36-
- uses: actions/checkout@v2
38+
- uses: folio-org/checkout@v2
3739
with:
3840
fetch-depth: 0
3941

@@ -67,39 +69,30 @@ jobs:
6769
run: yarn lint
6870
continue-on-error: true
6971

70-
- name: Get number of CPU cores
71-
id: cpu-cores
72-
uses: SimenB/github-actions-cpu-cores@v1
73-
7472
- name: Run yarn test
75-
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS --max-workers ${{ steps.cpu-cores.outputs.count }}
73+
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS
7674

7775
- name: Run yarn formatjs-compile
78-
if : ${{ env.COMPILE_TRANSLATION_FILES == 'true' }}
76+
if: ${{ env.COMPILE_TRANSLATION_FILES == 'true' }}
7977
run: yarn formatjs-compile
8078

81-
- name: Generate Module descriptor
79+
- name: Generate FOLIO module descriptor
8280
if: ${{ env.PUBLISH_MOD_DESCRIPTOR == 'true' }}
8381
run: yarn build-mod-descriptor
8482

85-
- name: debug mod descriptor
83+
- name: Print FOLIO module descriptor
8684
if: ${{ env.PUBLISH_MOD_DESCRIPTOR == 'true' }}
8785
run: cat module-descriptor.json
8886

89-
- name: Upload event file
90-
uses: actions/upload-artifact@v3
91-
with:
92-
name: Event File
93-
path: ${{ github.event_path }}
94-
retention-days: 30
95-
96-
- name: Upload Jest results
87+
- name: Publish Jest unit test results
88+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
9789
if: always()
98-
uses: actions/upload-artifact@v3
9990
with:
100-
name: jest-test-results
101-
path: ${{ env.JEST_JUNIT_OUTPUT_DIR }}/*.xml
102-
retention-days: 30
91+
github_token: ${{ github.token }}
92+
files: "${{ env.JEST_JUNIT_OUTPUT_DIR }}/*.xml"
93+
check_name: Jest Unit Test Results
94+
comment_mode: update last
95+
comment_title: Jest Unit Test Statistics
10396

10497
- name: Publish Jest coverage report
10598
uses: actions/upload-artifact@v2
@@ -109,6 +102,32 @@ jobs:
109102
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
110103
retention-days: 30
111104

105+
- name: Publish BigTest unit test results
106+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
107+
if: always()
108+
with:
109+
github_token: ${{ github.token }}
110+
files: "${{ env.BIGTEST_JUNIT_OUTPUT_DIR }}/*.xml"
111+
check_name: BigTest Unit Test Results
112+
comment_mode: update last
113+
comment_title: BigTest Unit Test Statistics
114+
115+
- name: Publish BigTest coverage report
116+
uses: actions/upload-artifact@v2
117+
if: always()
118+
with:
119+
name: bigtest-coverage-report
120+
path: ${{ env.BIGTEST_COVERAGE_REPORT_DIR }}
121+
retention-days: 30
122+
123+
- name: Publish yarn.lock
124+
uses: actions/upload-artifact@v2
125+
if: failure()
126+
with:
127+
name: yarn.lock
128+
path: yarn.lock
129+
retention-days: 5
130+
112131
- name: Set default branch as env variable
113132
run: echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV
114133

@@ -139,13 +158,15 @@ jobs:
139158
always-auth: true
140159

141160
- name: Set _auth in .npmrc
161+
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
142162
run: |
143163
npm config set @folio:registry $FOLIO_NPM_REGISTRY
144164
npm config set $FOLIO_NPM_REGISTRY_AUTH:_auth $NODE_AUTH_TOKEN
145165
env:
146166
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
147167

148168
- name: Exclude some CI-generated artifacts in package
169+
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
149170
run: |
150171
echo "artifacts" >> .npmignore
151172
echo ".github" >> .npmignore
@@ -178,19 +199,3 @@ jobs:
178199
username: ${{ secrets.FOLIO_REGISTRY_USERNAME }}
179200
password: ${{ secrets.FOLIO_REGISTRY_PASSWORD }}
180201

181-
# restoring "github-actions-ci" with some dummy steps
182-
# to maybe allow PR #14 to succeed, where it is stuck
183-
# in "Waiting for status to be reported" ATM.
184-
github-actions-ci:
185-
runs-on: ubuntu-latest
186-
steps:
187-
- uses: folio-org/checkout@v2
188-
with:
189-
fetch-depth: 0
190-
191-
- name: Use Node.js
192-
uses: actions/setup-node@v2
193-
with:
194-
node-version: ${{ env.NODEJS_VERSION }}
195-
check-latest: true
196-
always-auth: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ artifacts
66
npm-debug.log
77
yarn.lock
88
package-lock.json
9-
junit.xml
9+
yarn-error.log
10+
.vscode
11+
.idea
12+
junit.xml

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
*.swp
3+
*.swo
4+
node_modules
5+
yarn.lock
6+

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
## 1.0.0
77

8-
* New app created with stripes-cli
8+
* New app created with stripes-cli. Updated module after created with stripes-cli. Refs UIREQMED-1.

0 commit comments

Comments
 (0)