From 9c6675e8b19e7a9c6826e09d71eb23497ba4bd8a Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 13:14:22 -0700 Subject: [PATCH 1/9] Introduce ci --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ec2212b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: NodeJS SDK CI + +on: + workflow_dispatch: + push: + branches: + - master + - support/SDK-V3 + - feature/** + - bugfix/** + pull_request: + branches: + - master + - support/SDK-V3 + - feature/** + - bugfix/** +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [8.x, 10.x, 14.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm install + - run: npm ci + - run: npm run build --if-present + - run: npm run coveralls + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 4428d1e..cc05654 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "docs": "esdoc -c ./.esdoc.json", "deploy-docs": "npm run docs && gh-pages -d docs", "test": "npm run lint && npm run test-unit", - "test-unit": "mocha --compilers js:babel-register test/**/*.js test/*.js", + "test-unit": "nyc --reporter lcov mocha --report lcovonly --require babel-core/register test/**/*.js test/*.js", "test-coverage": "nyc npm run test", "coveralls": "npm run test-coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "prepublish-prod": "npm test && npm run prod", From a24d862a52bd6925785acc05338ea259583e8977 Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 13:29:25 -0700 Subject: [PATCH 2/9] Change test-unit task --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc05654..38cda6a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "docs": "esdoc -c ./.esdoc.json", "deploy-docs": "npm run docs && gh-pages -d docs", "test": "npm run lint && npm run test-unit", - "test-unit": "nyc --reporter lcov mocha --report lcovonly --require babel-core/register test/**/*.js test/*.js", + "test-unit": "nyc report --reporter=lcov mocha --report lcovonly --require babel-core/register test/**/*.js test/*.js", "test-coverage": "nyc npm run test", "coveralls": "npm run test-coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "prepublish-prod": "npm test && npm run prod", From 915aac211cb22f9eaac1f3155443cb11695530a2 Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 13:33:42 -0700 Subject: [PATCH 3/9] Change test-unit task --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 38cda6a..7c27d08 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "docs": "esdoc -c ./.esdoc.json", "deploy-docs": "npm run docs && gh-pages -d docs", "test": "npm run lint && npm run test-unit", - "test-unit": "nyc report --reporter=lcov mocha --report lcovonly --require babel-core/register test/**/*.js test/*.js", + "test-unit": "nyc --reporter lcov mocha --require babel-core/register test/**/*.js test/*.js", "test-coverage": "nyc npm run test", - "coveralls": "npm run test-coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", + "coveralls": "npm run test-coverage", "prepublish-prod": "npm test && npm run prod", "publish-please": "publish-please", "prepublish": "publish-please guard" From 8f8c976aca4fe99fd285dbb269d43e0e15e39d51 Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 13:36:47 -0700 Subject: [PATCH 4/9] Call the task test-coverage for build the coveralls report --- .github/workflows/ci.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec2212b..6ec59a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - run: npm install - run: npm ci - run: npm run build --if-present - - run: npm run coveralls + - run: npm run test-coverage - name: Coveralls uses: coverallsapp/github-action@master diff --git a/package.json b/package.json index 7c27d08..05b491b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "test": "npm run lint && npm run test-unit", "test-unit": "nyc --reporter lcov mocha --require babel-core/register test/**/*.js test/*.js", "test-coverage": "nyc npm run test", - "coveralls": "npm run test-coverage", + "coveralls": "npm run test-coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "prepublish-prod": "npm test && npm run prod", "publish-please": "publish-please", "prepublish": "publish-please guard" From f922af6dece211fe8cf0a06373bb29370c811285 Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 14:08:09 -0700 Subject: [PATCH 5/9] Split on ci and documentation steps --- .github/workflows/ci.yml | 10 +--- .github/workflows/documentation.yml | 78 +++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ec59a6..dd45d8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,12 @@ on: - bugfix/** jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [8.x, 10.x, 14.x] + node-version: [8.x, 10.x, 14.x , 16.x] steps: - uses: actions/checkout@v3 @@ -35,9 +34,4 @@ jobs: - run: npm install - run: npm ci - run: npm run build --if-present - - run: npm run test-coverage - - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + - run: npm run test diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..6d0c67c --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,78 @@ +name: Update Documentation + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + documentation: + # Generate documentation and push to gh-pages branch using the predefined JDK versions in the strategy section + name: Documentation + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [ 8.x ] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm install + - run: npm run docs + + - name: Copy to documentation Website Location + run: | + mkdir ../gh-pages + cp -r docs/* ../gh-pages/ + cd ../gh-pages + + - name: Commit documentation changes + run: | + if [[ `git status --porcelain` ]]; then + echo "Commit documentation" + # Set identity + git config --global user.email "dev-git-action@paypal.com" + git config --global user.name "Git Action Doc" + + # Add branch + git checkout -B gh-pages + + # Push generated files + git add -A + git commit -m "Documentation updated" + git push origin gh-pages -fq > /dev/null + fi + code-coverage: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [ 8.x ] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm install + - run: npm ci + - run: npm run build --if-present + - run: npm run test-coverage + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From ed91ebc42ac97da8caaf01b08ccf79e917697f5b Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 14:10:32 -0700 Subject: [PATCH 6/9] Add lts version from node v8 - v16 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd45d8a..12fc592 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,13 +15,13 @@ on: - feature/** - bugfix/** jobs: - build: + test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [8.x, 10.x, 14.x , 16.x] + node-version: [8.x ,10.x, 12.x ,14.x ,16.x] steps: - uses: actions/checkout@v3 From f88a603e07628674f76e9461b4e73deedef38dab Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 14:12:10 -0700 Subject: [PATCH 7/9] Sync package-lock.json --- package-lock.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index d7a5442..d38a020 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8648,7 +8648,8 @@ "dependencies": { "ansi-regex": { "version": "5.0.0", - "resolved": "", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, "find-up": { From 2d08dabbd776fbfb8a83b70fe9869d9265701be2 Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Tue, 23 Aug 2022 14:16:30 -0700 Subject: [PATCH 8/9] Sync package-lock.json --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12fc592..f171992 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,31 @@ jobs: cache: 'npm' - run: npm install - - run: npm ci - run: npm run build --if-present - run: npm run test + + code-coverage: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [ 8.x ] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm install + - run: npm ci + - run: npm run build --if-present + - run: npm run test-coverage + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 2d033b41db86dd62abcc3dd51aaefa8f9d7b267e Mon Sep 17 00:00:00 2001 From: Gustavo Meyer Date: Wed, 24 Aug 2022 13:31:37 -0700 Subject: [PATCH 9/9] Remove the report test coverage from documentation CI pipeline --- .github/workflows/ci.yml | 1 - .github/workflows/documentation.yml | 25 ------------------------- 2 files changed, 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f171992..77a1194 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,6 @@ jobs: cache: 'npm' - run: npm install - - run: npm ci - run: npm run build --if-present - run: npm run test-coverage diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 6d0c67c..1964bee 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -51,28 +51,3 @@ jobs: git commit -m "Documentation updated" git push origin gh-pages -fq > /dev/null fi - code-coverage: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - node-version: [ 8.x ] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - - run: npm install - - run: npm ci - - run: npm run build --if-present - - run: npm run test-coverage - - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }}