From 9ae1197148eac1249c7e0baf39595a3bd6124bbd Mon Sep 17 00:00:00 2001 From: "javier.brea" Date: Mon, 21 Dec 2020 10:19:16 +0100 Subject: [PATCH 1/4] chore(ci): Migrate to Github actions. Support all nodejs releases that have not passed their end date --- .github/workflows/build.yml | 69 +++++++++++++++++++++ .github/workflows/check-package-version.yml | 44 +++++++++++++ .github/workflows/publish-to-github.yml | 20 ++++++ .github/workflows/publish-to-npm.yml | 18 ++++++ .travis.yml | 2 - CHANGELOG.md | 2 + README.md | 6 +- package-lock.json | 53 ---------------- package.json | 7 +-- 9 files changed, 158 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check-package-version.yml create mode 100644 .github/workflows/publish-to-github.yml create mode 100644 .github/workflows/publish-to-npm.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..144cab7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: build +on: + push: + branches: + - master + - release + pull_request: +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node: ["10.23.0", "12.19.0", "14.15.0", "15.2.0"] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" + id: extract-branch + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies + run: npm ci + - name: Lint + run: npm run lint + - name: Test unit + run: npm run test:unit + - name: Upload test results + uses: actions/upload-artifact@v2 + with: + name: coverage-${{ matrix.node }} + path: coverage + retention-days: 1 + quality: + runs-on: ubuntu-latest + needs: test + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download test results + uses: actions/download-artifact@v2 + with: + name: coverage-15.2.0 + path: coverage + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: SonarCloud Scan + if: env.SONAR_TOKEN != '' + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/check-package-version.yml b/.github/workflows/check-package-version.yml new file mode 100644 index 0000000..f300bed --- /dev/null +++ b/.github/workflows/check-package-version.yml @@ -0,0 +1,44 @@ +name: check-package-version +on: + pull_request: + branches: + - master +jobs: + check-package-version: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Get NPM version is new + id: check + uses: EndBug/version-check@v1.6.0 + with: + diff-search: true + file-name: ./package.json + file-url: https://unpkg.com/@mocks-server/admin-api-client@latest/package.json + static-checking: localIsNew + - name: Check version is new + if: steps.check.outputs.changed != 'true' + run: | + echo "Version not changed" + exit 1 + - name: Get NPM version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.1.0 + - name: Check Changelog version + id: changelog_reader + uses: mindsers/changelog-reader-action@v2.0.0 + with: + version: ${{ steps.package-version.outputs.current-version }} + path: ./CHANGELOG.md + - name: Read version from Sonar config + id: sonar-version + uses: christian-draeger/read-properties@1.0.1 + with: + path: './sonar-project.properties' + property: 'sonar.projectVersion' + - name: Check Sonar version + if: steps.sonar-version.outputs.value != steps.package-version.outputs.current-version + run: | + echo "Version not changed" + exit 1 diff --git a/.github/workflows/publish-to-github.yml b/.github/workflows/publish-to-github.yml new file mode 100644 index 0000000..9cf52f2 --- /dev/null +++ b/.github/workflows/publish-to-github.yml @@ -0,0 +1,20 @@ +name: publish-to-github +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci + - run: npm run build + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@mocks-server' + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml new file mode 100644 index 0000000..710059c --- /dev/null +++ b/.github/workflows/publish-to-npm.yml @@ -0,0 +1,18 @@ +name: publish-to-npm +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org/' + - run: npm ci + - run: npm run build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 21e842b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -version: ~> 1.0 -import: mocks-server/ci-cd:.travis-build-deploy.yml@master diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f6e7d9..6e3dea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] ### Added ### Changed +- chore(ci): Migrate from Travis CI to github actions +- chore(deps): Support all Node.js releases that have not passed their end date ### Fixed ### Removed diff --git a/README.md b/README.md index bc944c1..98943a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status][travisci-image]][travisci-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Quality Gate][quality-gate-image]][quality-gate-url] +[![Build status][build-image]][build-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Quality Gate][quality-gate-image]][quality-gate-url] [![NPM dependencies][npm-dependencies-image]][npm-dependencies-url] [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com) [![Last commit][last-commit-image]][last-commit-url] [![Last release][release-image]][release-url] @@ -84,8 +84,8 @@ Please read the [contributing guidelines](.github/CONTRIBUTING.md) and [code of [coveralls-image]: https://coveralls.io/repos/github/mocks-server/admin-api-client/badge.svg [coveralls-url]: https://coveralls.io/github/mocks-server/admin-api-client -[travisci-image]: https://travis-ci.com/mocks-server/admin-api-client.svg?branch=master -[travisci-url]: https://travis-ci.com/mocks-server/admin-api-client +[build-image]: https://github.com/mocks-server/admin-api-client/workflows/build/badge.svg?branch=master +[build-url]: https://github.com/mocks-server/admin-api-client/actions?query=workflow%3Abuild+branch%3Amaster [last-commit-image]: https://img.shields.io/github/last-commit/mocks-server/admin-api-client.svg [last-commit-url]: https://github.com/mocks-server/admin-api-client/commits [license-image]: https://img.shields.io/npm/l/@mocks-server/admin-api-client.svg diff --git a/package-lock.json b/package-lock.json index 99818c5..7ce709d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3949,19 +3949,6 @@ "yaml": "^1.10.0" } }, - "coveralls": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.9.tgz", - "integrity": "sha512-nNBg3B1+4iDox5A5zqHKzUTiwl2ey4k2o0NEcVZYvl+GOSJdKBj4AJGKLv6h3SvWch7tABHePAQOSZWM9E2hMg==", - "dev": true, - "requires": { - "js-yaml": "^3.13.1", - "lcov-parse": "^1.0.0", - "log-driver": "^1.2.7", - "minimist": "^1.2.0", - "request": "^2.88.0" - } - }, "cross-fetch": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.6.tgz", @@ -7312,12 +7299,6 @@ "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=", "dev": true }, - "lcov-parse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", - "integrity": "sha1-6w1GtUER68VhrLTECO+TY73I9+A=", - "dev": true - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -7590,12 +7571,6 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, - "log-driver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", - "dev": true - }, "log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", @@ -8726,34 +8701,6 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, "request-promise-core": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", diff --git a/package.json b/package.json index d39c8e3..702f540 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,7 @@ "mocks:install": "cd mocks && npm i", "mocks:ci": "cd mocks && npm run mocks:ci", "test": "jest", - "test:coverage": "npm run mocks:install && start-server-and-test mocks:ci tcp:3200 test", - "coveralls": "cat ./coverage/lcov.info | coveralls", - "test:ci": "npm run test:coverage" + "test:unit": "npm run mocks:install && start-server-and-test mocks:ci tcp:3200 test" }, "dependencies": { "cross-fetch": "3.0.6", @@ -45,7 +43,6 @@ "babel-eslint": "10.1.0", "babel-jest": "26.6.1", "babel-polyfill": "6.26.0", - "coveralls": "3.0.9", "eslint": "7.12.1", "eslint-config-prettier": "6.15.0", "eslint-plugin-prettier": "3.1.4", @@ -71,6 +68,6 @@ } }, "engines": { - "node": "12.x || 14.x" + "node": "10.x || 12.x || 14.x || 15.x" } } From 11f52d25f7883d52c8d4918586a59dc36933d2b5 Mon Sep 17 00:00:00 2001 From: "javier.brea" Date: Mon, 21 Dec 2020 10:39:09 +0100 Subject: [PATCH 2/4] chore(deps): Revert add support for node 10.x --- CHANGELOG.md | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e3dea3..e7871b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added ### Changed - chore(ci): Migrate from Travis CI to github actions -- chore(deps): Support all Node.js releases that have not passed their end date ### Fixed ### Removed diff --git a/package.json b/package.json index 702f540..149c87b 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,6 @@ } }, "engines": { - "node": "10.x || 12.x || 14.x || 15.x" + "node": "12.x || 14.x || 15.x" } } From f0d3d4044522f74f2e9cb54d75f19800371c613e Mon Sep 17 00:00:00 2001 From: "javier.brea" Date: Mon, 21 Dec 2020 10:48:13 +0100 Subject: [PATCH 3/4] chore(deps): Revert add support for node 10.x --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 144cab7..d2e38b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ["10.23.0", "12.19.0", "14.15.0", "15.2.0"] + node: ["12.19.0", "14.15.0", "15.2.0"] steps: - name: Checkout uses: actions/checkout@v2 From 45e1808df9820929e773e5c75d220fe21866979b Mon Sep 17 00:00:00 2001 From: "javier.brea" Date: Mon, 21 Dec 2020 11:16:28 +0100 Subject: [PATCH 4/4] chore(release): Upgrade version --- CHANGELOG.md | 9 ++++++++- package-lock.json | 2 +- package.json | 2 +- sonar-project.properties | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7871b2..d3f27b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] ### Added ### Changed -- chore(ci): Migrate from Travis CI to github actions ### Fixed ### Removed +## [2.0.5] - 2020-12-21 + +### Added +- chore(deps): Add support for Node.js v15.x + +### Changed +- chore(ci): Migrate from Travis CI to github actions + ## [2.0.4] - 2020-10-27 ### Changed - Update dependencies diff --git a/package-lock.json b/package-lock.json index 7ce709d..081776e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mocks-server/admin-api-client", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 149c87b..1a16a7a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mocks-server/admin-api-client", - "version": "2.0.4", + "version": "2.0.5", "description": "Client of @mocks-server/plugin-admin-api", "keywords": [ "mocks-server-plugin", diff --git a/sonar-project.properties b/sonar-project.properties index fd6c1b6..9dc60e5 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ sonar.organization=mocks-server sonar.projectKey=mocks-server-admin-api-client -sonar.projectVersion=2.0.4 +sonar.projectVersion=2.0.5 sonar.javascript.file.suffixes=.js sonar.sourceEncoding=UTF-8