Skip to content

Commit

Permalink
Merge pull request #39 from reportportal/workflow-changes
Browse files Browse the repository at this point in the history
Workflow changes
  • Loading branch information
AmsterGet authored Mar 6, 2021
2 parents 2b0fd5f + e5c6747 commit 25d1a0e
Show file tree
Hide file tree
Showing 21 changed files with 6,515 additions and 585 deletions.
2 changes: 0 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
"no-void": "error",
"no-warning-comments": "off",
"no-with": "error",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "error",
"radix": "error",
"require-await": "error",
Expand Down Expand Up @@ -321,7 +320,6 @@
"prefer-destructuring": "off",
"prefer-numeric-literals": "off",
"prefer-rest-params": "off",
"prefer-spread": "error",
"prefer-template": "off",
"require-yield": "error",
"rest-spread-spacing": "error",
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2021 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI-pipeline

on:
push:
branches:
- develop
- '!master'
paths-ignore:
- README.md
- CHANGELOG.md
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run tests
run: npm test
- name: Check coverage
run: npm run test:coverage
72 changes: 72 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2021 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: publish

on:
repository_dispatch:
types: [version-released]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Clean install of node dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run tests
run: npm test
- name: Check coverage
run: npm run test:coverage

publish-to-npm-and-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: 'https://registry.npmjs.org'
- name: Clean install of node dependencies
run: npm ci
- name: Publish to NPM
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config list
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: 'https://npm.pkg.github.com'
scope: '@reportportal'
- name: Publish to GPR
run: |
npm config set //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN
npm config set scope '@reportportal'
npm config list
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
153 changes: 153 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Copyright 2021 EPAM Systems
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: release

on:
push:
branches:
- master
paths-ignore:
- '.github/**'
- README.md
- CHANGELOG.md

env:
versionFileName: 'VERSION'
versionFragmentFileName: 'version_fragment'
changelogFileName: 'CHANGELOG.md'
jobs:
calculate-version:
runs-on: ubuntu-latest
outputs:
releaseVersion: ${{ steps.exposeVersion.outputs.releaseVersion }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read version
id: readVersion
run: |
read -r version < ${{ env.versionFileName }}
echo "Snapshot version: $version";
version=$(echo $version | sed 's/-SNAPSHOT//');
echo $version;
echo "::set-output name=version::$version"
read -r versionFragment < ${{ env.versionFragmentFileName }}
echo $versionFragment
if [[ "$versionFragment" == "minor" ]]; then
versionFragment=feature
echo "Minor version will be used"
elif [[ "$versionFragment" == "major" ]]; then
echo "Major version will be used"
else
versionFragment=patch
echo "Patch version will be used"
fi
echo "::set-output name=versionFragment::$versionFragment"
- name: Bump release version if needed according to version fragment
if: steps.readVersion.outputs.versionFragment != 'patch'
id: bumpVersion
uses: christian-draeger/increment-semantic-version@1.0.1
with:
current-version: ${{ steps.readVersion.outputs.version }}
version-fragment: ${{ steps.readVersion.outputs.versionFragment }}
- name: Expose release version
id: exposeVersion
run: |
versionFragment=${{ steps.readVersion.outputs.versionFragment }}
if [[ "$versionFragment" != "patch" ]]; then
echo "::set-output name=releaseVersion::${{ steps.bumpVersion.outputs.next-version }}"
else
echo "::set-output name=releaseVersion::${{ steps.readVersion.outputs.version }}"
fi
create-tag:
needs: calculate-version
runs-on: ubuntu-latest
outputs:
versionInfo: ${{ steps.readChangelogEntry.outputs.log_entry }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Configure git
run: |
git config --global user.email "reportportal.io"
git config --global user.name "reportportal.io"
git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Update VERSION file
run: |
echo "${{ needs.calculate-version.outputs.releaseVersion }}" > ${{ env.versionFileName }}
git status
git add ${{ env.versionFileName }}
git commit -m "Update VERSION file with ${{ needs.calculate-version.outputs.releaseVersion }}"
- name: Create tag
run: |
git tag -a v${{ needs.calculate-version.outputs.releaseVersion }} -m ${{ needs.calculate-version.outputs.releaseVersion }}
npm version from-git
git push origin master
- name: Update version in changelog file
run: |
releaseDate=$(date +'%Y-%m-%d')
echo "Release date: $releaseDate"
versionInfo="## [${{ needs.calculate-version.outputs.releaseVersion }}] - $releaseDate"
sed -i '1s/^/\n'"$versionInfo"'\n/' ${{ env.changelogFileName }}
git status
git add ${{ env.changelogFileName }}
git commit -m "Mention ${{ needs.calculate-version.outputs.releaseVersion }} version in changelog file"
git push origin master
- name: Read changelog Entry
id: readChangelogEntry
uses: mindsers/changelog-reader-action@v1.1.0
with:
version: ${{ needs.calculate-version.outputs.releaseVersion }}
path: ./${{ env.changelogFileName }}
- name: Bump snapshot version
id: bumpSnapshotVersion
uses: christian-draeger/increment-semantic-version@1.0.1
with:
current-version: ${{ needs.calculate-version.outputs.releaseVersion }}
version-fragment: 'bug'
- name: Update develop with snapshot version
run: |
git fetch
git checkout develop
git merge master -Xtheirs --allow-unrelated-histories
echo "${{ steps.bumpSnapshotVersion.outputs.next-version }}-SNAPSHOT" > ${{ env.versionFileName }}
git status
git add ${{ env.versionFileName }}
git commit -m "${{ needs.calculate-version.outputs.releaseVersion }} -> ${{ steps.bumpSnapshotVersion.outputs.next-version }}-SNAPSHOT"
git push origin develop
create-release:
needs: [calculate-version, create-tag]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ needs.calculate-version.outputs.releaseVersion }}
release_name: Release v${{ needs.calculate-version.outputs.releaseVersion }}
body: ${{ needs.create-tag.outputs.versionInfo }}
draft: false
prerelease: false
- name: Trigger the publish workflow
if: success()
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_TOKEN }}
event-type: version-released
24 changes: 5 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,9 @@ typings/
# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache
# IDE
.vscode/
.idea/

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

# VS code
.vscode/
# Npm configuration file
.npmrc
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
.gitignore
.editorconfig
.github/
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Changed
- The architecture of the agent-js-postman's reporting

### Added
- Full compatibility with ReportPortal version 5.* (see [reportportal releases](https://github.com/reportportal/reportportal/releases))

### Deprecated
- Previous packages [newman-reporter-reportportal](https://www.npmjs.com/package/newman-reporter-reportportal) and [@reportportal/newman-reporter-reportportal](https://www.npmjs.com/package/@reportportal/newman-reporter-reportportal) will no longer supported by reportportal.io
3 changes: 0 additions & 3 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @reportportal/newman-reporter-agent-js-postman
# @reportportal/agent-js-postman

Newman runtime reporter for ReportPortal which provides information about collection run.
[ReportPortal](http://reportportal.io/)<br>
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.0.0-SNAPSHOT
15 changes: 5 additions & 10 deletions __tests__/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

const path = require('path');
const utils = require('./../lib/utils');
const { testPatterns, pmVariablesTestCaseIdPatterns } = require('./../lib/constants/patterns');
const pjson = require('./../package.json');
Expand Down Expand Up @@ -308,12 +309,9 @@ describe('utils', () => {

describe('getCollectionPath', function () {
test('should return correct collection path with separator', function () {
jest.mock('path', () => ({
sep: '\\'
}));
jest.spyOn(process, 'cwd').mockImplementation(() => 'C:\\testProject');
jest.spyOn(process, 'cwd').mockImplementation(() => `C:${path.sep}testProject`);
const mockedTest = {
filePath: 'C:\\testProject\\test\\example.js'
filePath: `C:${path.sep}testProject${path.sep}test${path.sep}example.js`
};
const expectedCollectionPath = 'test/example.js';

Expand All @@ -323,12 +321,9 @@ describe('utils', () => {
});

test('should return correct collection path without separator', function () {
jest.mock('path', () => ({
sep: '\\'
}));
jest.spyOn(process, 'cwd').mockImplementation(() => 'C:\\testProject');
jest.spyOn(process, 'cwd').mockImplementation(() => `C:${path.sep}testProject`);
const mockedTest = {
filePath: 'C:\\testProject\\example.js'
filePath: `C:${path.sep}testProject${path.sep}example.js`
};
const expectedCollectionPath = 'example.js';

Expand Down
Binary file removed img/ahold-delhaize-logo-green.jpg
Binary file not shown.
Loading

0 comments on commit 25d1a0e

Please sign in to comment.