Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies #86

Merged
merged 8 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ on:
- develop
paths:
- "azure-devops-extension/run-automator-build-task/**"
- .github/workflows/node.js.yml
pull_request:
types: [opened, synchronize, reopened]
paths:
- "azure-devops-extension/run-automator-build-task/**"
- .github/workflows/node.js.yml

jobs:
node-test:
Expand All @@ -26,6 +28,12 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: npm install -g yarn
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: azure-devops-extension/run-automator-build-task
- name: Build
run: yarn build
working-directory: azure-devops-extension/run-automator-build-task
- name: Test
run: yarn test
working-directory: azure-devops-extension/run-automator-build-task
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
dist
.taskkey
99 changes: 0 additions & 99 deletions azure-devops-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,6 @@ It has the following tasks:

_Note: Unless `startOnly` is set to `true`, max polling time is set to 50 minutes. If the build takes longer than 50 minutes, it will automatically fail the pipeline._

### How to test (QA)

- Create accounts on: https://dev.azure.com/ (use @deepcrawl email address)
- Ask for extension permissions
- Once permission is given, install the extension from: https://marketplace.visualstudio.com/items?itemName=deepcrawl.automator-tools
- Generate an API key on: https://legacy.deepcrawl.com/dc-api
- Make sure you have the test suite created and the test suite id, if not create your test suite in Protect: https://protect.lumar.io/
- Create new private repository with default README: https://github.com/new
- Go to your Azure Organisation page: http://dev.azure.com/
- Create new project
- Pipelines -> Create new pipeline
- Authorise Github and set the repo to the one created previously
- Install it to your repo
- Select Starter Pipeline , once in Configure tab
- On next step, complete the `yaml`file with:

```yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: run-automator-build-task@1
inputs:
userKeyId: 'USER_KEY_ID' (string - generate new api key on Lumar core app)
userKeySecret: 'USER_KEY_SECRET' (string - generate new api key on Lumar core app)
testSuiteId: 'TEST_SUITE_ID' (string - use your created test suite id)
ciBuildId: 'CI_BUILD_ID' (optional - string)
startOnly: false (optional - boolean - use it if you want to skip polling)
```

- Save and run
- Go to the job and check it
- Once tested, make sure to remove the Lumar api key generated

### Inputs

#### Required variables
Expand All @@ -81,67 +46,3 @@ testSuiteId: <string>
startOnly: <boolean>
ciBuildId: <string>
```

### Requirements

- Install yarn globally

```
npm install -g yarn
```

- Install npm packages

```
yarn
```

### Build

```
yarn build
```

### Running locally

To run locally, set the following environment variables:

```
INPUT_USERKEYID: <string> (required)
INPUT_USERKEYSECRET: <string> (required)
INPUT_TESTSUITEID: <string> (required)
INPUT_STARTONLY: <boolean> (optional)
INPUT_CIBUILDID: <string> (optional)
```

and run:

```
yarn start
```

### Test

```
yarn test
```

### Lint

```
yarn lint
```

## Release

In order to release, the following steps should be followed:

- In each of your modified task, increment the version of the task in `task.json`
- Increment the version of the extension accordingly, in `vss-extension.json`
- Package the extension:

```
yarn release
```

- Manually release the extension through Azure Devops extensions
2 changes: 1 addition & 1 deletion azure-devops-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"author": "Andrei Bitca, Daniel Mon Chit & Lukas Kalcok",
"license": "ISC",
"devDependencies": {
"tfx-cli": "^0.9.2"
"tfx-cli": "^0.14.0"
}
}
19 changes: 19 additions & 0 deletions azure-devops-extension/run-automator-build-task/docs/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Requirements

- Install yarn globally

```
npm install -g yarn
```

- Install npm packages

```
yarn
```

### Build

```
yarn build
```
15 changes: 15 additions & 0 deletions azure-devops-extension/run-automator-build-task/docs/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Release

Requires: [Build](build.md)

In order to release, the following steps should be followed:

- In each of your modified task, increment the version of the task in `task.json`
- Increment the version of the extension accordingly, in `vss-extension.json`
- Package the extension:

```
yarn release
```

- Manually release the extension through Azure Devops extensions
17 changes: 17 additions & 0 deletions azure-devops-extension/run-automator-build-task/docs/run-local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Running locally

To run locally, set the following environment variables:

```
INPUT_USERKEYID: <string> (required)
INPUT_USERKEYSECRET: <string> (required)
INPUT_TESTSUITEID: <string> (required)
INPUT_STARTONLY: <boolean> (optional)
INPUT_CIBUILDID: <string> (optional)
```

and run:

```
yarn start
```
34 changes: 34 additions & 0 deletions azure-devops-extension/run-automator-build-task/docs/test-qa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### How to test (QA)

- Create accounts on: https://dev.azure.com/ (use @deepcrawl email address)
- Ask for extension permissions
- Once permission is given, install the extension from: https://marketplace.visualstudio.com/items?itemName=deepcrawl.automator-tools
- Generate an API key on: https://legacy.deepcrawl.com/dc-api
- Make sure you have the test suite created and the test suite id, if not create your test suite in Protect: https://protect.lumar.io/
- Create new private repository with default README: https://github.com/new
- Go to your Azure Organisation page: http://dev.azure.com/
- Create new project
- Pipelines -> Create new pipeline
- Authorise Github and set the repo to the one created previously
- Install it to your repo
- Select Starter Pipeline , once in Configure tab
- On next step, complete the `yaml`file with:

```yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: run-automator-build-task@1
inputs:
userKeyId: 'USER_KEY_ID' (string - generate new api key on Lumar core app)
userKeySecret: 'USER_KEY_SECRET' (string - generate new api key on Lumar core app)
testSuiteId: 'TEST_SUITE_ID' (string - use your created test suite id)
ciBuildId: 'CI_BUILD_ID' (optional - string)
startOnly: false (optional - boolean - use it if you want to skip polling)
```

- Save and run
- Go to the job and check it
- Once tested, make sure to remove the Lumar api key generated
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
automock: false,
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/src/**/*.ts", "!<rootDir>/src/**/*.integration.ts", "!<rootDir>/src/**/*.test.ts"],
coveragePathIgnorePatterns: ["<rootDir>/src/index.ts", "<rootDir>/src/automator-sdk-client.ts"],
coverageDirectory: "coverage",
coverageReporters: ["html", "json", "text-summary"],
coverageThreshold: {
Expand Down
39 changes: 15 additions & 24 deletions azure-devops-extension/run-automator-build-task/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,37 @@
},
"author": "Andrei Bitca, Daniel Mon Chit & Lukas Kalcok",
"license": "ISC",
"resolutions": {
"cross-fetch": "3.1.5",
"minimatch": "7.4.2",
"ws": "8.12.1"
},
"devDependencies": {
"@types/jest": "^26.0.22",
"@types/nock": "^11.1.0",
"@types/node-fetch": "^2.5.7",
"@types/pino": "^6.3.2",
"@types/node-fetch": "^2.6.2",
"@types/q": "^1.5.4",
"@types/sinon": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@zerollup/ts-transform-paths": "^1.7.18",
"eslint": "^7.9.0",
"eslint-config-deepcrawl": "^5.6.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-clean-code": "^0.1.12",
"eslint-plugin-filenames": "^1.3.2",
"eslint": "^8.35.0",
"eslint-config-deepcrawl": "^8.1.0",
AndKiel marked this conversation as resolved.
Show resolved Hide resolved
"eslint-plugin-graphql": "^4.0.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-json-format": "^2.0.1",
"eslint-plugin-no-loops": "^0.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-sonarjs": "^0.5.0",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"jest-fetch-mock": "^3.0.3",
"nock": "^13.0.4",
"nock": "^13.3.0",
"prettier": "^2.1.2",
"sinon": "^9.2.0",
"ts-jest": "^26.4.1",
"ttypescript": "^1.5.12",
"ttypescript": "^1.5.15",
"typescript": "^4.0.3",
"typescript-transform-paths": "3.4.6",
"y18n": "4.0.1"
},
"dependencies": {
"@apollo/client": "^3.2.2",
"axios": "^0.21.1",
"azure-pipelines-task-lib": "^2.11.2",
"graphql": "^15.3.0",
"node-fetch": "^2.6.1",
"pino": "^6.7.0",
"pino-pretty": "^4.3.0"
"azure-pipelines-task-lib": "^4.3.0",
"graphql": "^16.6.0",
"node-fetch": "^2.6.9",
"winston": "3.8.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe("#sleep", () => {
await sleep(1000);
const endTimeStamp = Date.now();
const secondsPassed = Math.floor((endTimeStamp - startTimeStamp) / 1000);
expect(secondsPassed).toEqual(1);
expect(secondsPassed).toBe(1);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import * as pino from "pino";
import {createLogger, format, transports} from "winston";

export const loggerService = pino({
level: "info",
prettyPrint: true,
const {colorize, combine, timestamp, printf} = format;
const upperLevel = format(info => {
info.level = info.level.toUpperCase();
return info;
});

export const loggerService = createLogger({
format: combine(
upperLevel(),
colorize({all: true}),
timestamp({format: "HH:mm:ss.sss"}),
printf(({level, message, timestamp}) => `[${timestamp}] ${level} (${process.pid}) : ${message}`),
),
transports: [new transports.Console()]
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import azurePipelinesTask = require("azure-pipelines-task-lib");
import azurePipelinesTask = require("azure-pipelines-task-lib/task");

import { inputParameters } from "@common/constants";
import { loggerService } from "@common/services/logger.service";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("AutomatorSDKClient", () => {
ciBuildId,
}),
).rejects.toEqual(new Error(testSuiteId));
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toEqual(true);
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toBe(true);
});

it("should throw error and delete token if tools api client #poll throws error", async () => {
Expand Down Expand Up @@ -70,8 +70,8 @@ describe("AutomatorSDKClient", () => {
ciBuildId,
isStartOnly: true,
});
expect(pollSpy.notCalled).toEqual(true);
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toEqual(true);
expect(pollSpy.notCalled).toBe(true);
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toBe(true);
});

it("should delete token in the end", async () => {
Expand All @@ -85,7 +85,7 @@ describe("AutomatorSDKClient", () => {
testSuiteId,
ciBuildId,
});
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toEqual(true);
expect(deleteAuthTokenSpy.calledOnceWith(`${userKeyId}|${userKeySecret}`)).toBe(true);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Object {
token
__typename
}
}
",
}",
"variables": Object {},
}
`;
Expand All @@ -23,8 +22,7 @@ Object {
token
__typename
}
}
",
}",
"variables": Object {
"userKeyId": "user-key-id",
"userKeySecret": "user-key-secret",
Expand Down
Loading