Skip to content

Commit

Permalink
Merge pull request #158 from JupiterOne/npm-dev-deps
Browse files Browse the repository at this point in the history
[No Ticket] - run prittier
  • Loading branch information
Sivli-Embir authored Jan 5, 2024
2 parents 24f4b5b + c0e5435 commit a05df84
Show file tree
Hide file tree
Showing 108 changed files with 1,494 additions and 939 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"project": "./tsconfig.json"
},
"ignorePatterns": [".eslintrc", "vitest.config.ts"]
}
}
3 changes: 1 addition & 2 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Runs build on the repo

runs:
using: "composite"
using: 'composite'
steps:
- name: build
shell: bash
run: npm run build

4 changes: 1 addition & 3 deletions .github/actions/build/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ This file is automatically leveraged when tests are run to determine which
steps should be skipped in the composite action. If these steps were not
mocked, they would break the test.
*/
export const BUILD_MOCK_STEPS = [
{ name: 'build' },
];
export const BUILD_MOCK_STEPS = [{ name: 'build' }];
18 changes: 9 additions & 9 deletions .github/actions/frontend/chromatic/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Frontend Runtime - Chromatic

This [composite action](./action.yml) is responsible for building nad publishing your Storybook to Chromatic and running visual regression tests.
This [composite action](./action.yml) is responsible for building nad publishing
your Storybook to Chromatic and running visual regression tests.

## Inputs

This action takes the following inputs:

| Name | Type | Default | Required | Description |
| --------------------------- | ------- | ---------------------------- | --------- | --------------------------------------------------------- |
| `github_token` | String | | True | Github access token
| `chromatic_project_token` | String | | True | The Chromatic API token
| `publish_chromatic` | String | | True | The Chromatic API token
| Name | Type | Default | Required | Description |
| ------------------------- | ------ | ------- | -------- | ----------------------- |
| `github_token` | String | | True | Github access token |
| `chromatic_project_token` | String | | True | The Chromatic API token |
| `publish_chromatic` | String | | True | The Chromatic API token |

## Outputs

No outputs provided.
No outputs provided.

## Example Usage

Expand All @@ -27,4 +28,3 @@ steps:
- name: validate
uses: jupiterone/.github/.github/actions/frontend/runtime/chromatic
```
4 changes: 2 additions & 2 deletions .github/actions/frontend/chromatic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ inputs:
required: true
type: string
publish_chromatic:
description: "If true, will publish to Chromatic. Otherwise will"
description: 'If true, will publish to Chromatic. Otherwise will'
type: boolean
default: false

runs:
using: "composite"
using: 'composite'
steps:
- name: chromatic_inputs
shell: bash
Expand Down
9 changes: 5 additions & 4 deletions .github/actions/frontend/cortex/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Frontend - Cortex

This [composite action](./action.yml) is responsible for running Cortex related jobs for Frontend Projects.
This [composite action](./action.yml) is responsible for running Cortex related
jobs for Frontend Projects.

## Inputs

This action takes the following inputs:

| Name | Type | Default | Required | Description |
| --------------------------- | ------- | ---------------------------------- | --------- | --------------------------------------------------------- |
| `cortex_api_key` | String | | True | The key that allows us to push data to Cortex
| Name | Type | Default | Required | Description |
| ---------------- | ------ | ------- | -------- | --------------------------------------------- |
| `cortex_api_key` | String | | True | The key that allows us to push data to Cortex |

## Outputs

Expand Down
7 changes: 4 additions & 3 deletions .github/actions/frontend/cortex/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ inputs:
type: string
required: true


runs:
using: "composite"
using: 'composite'
steps:
- name: cortex_inputs
shell: bash
run: |
echo "cortex_api_key=${{ inputs.cortex_api_key }}"
- name: push_to_cortex
run: npx --yes -p @jupiterone/web-tools-platform-analytics@latest platform-analytics all
run:
npx --yes -p @jupiterone/web-tools-platform-analytics@latest
platform-analytics all
shell: bash
env:
CORTEX_API_KEY: ${{ inputs.cortex_api_key }}
4 changes: 1 addition & 3 deletions .github/actions/frontend/cortex/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ This file is automatically leveraged when tests are run to determine which
steps should be skipped in the composite action. If these steps were not
mocked, they would break the test.
*/
export const CORTEX_MOCK_STEPS = [
{ name: 'push_to_cortex' },
];
export const CORTEX_MOCK_STEPS = [{ name: 'push_to_cortex' }];
11 changes: 6 additions & 5 deletions .github/actions/frontend/npm/publish/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Frontend NPM - Release

This [composite action](./action.yml) is responsible for deploying a frontend npm package.
This [composite action](./action.yml) is responsible for deploying a frontend
npm package.

## Inputs

This action takes the following inputs:

| Name | Type | Default | Required | Description |
| --------------------------- | ------- | ---------------------------- | --------- | --------------------------------------------------------- |
| `use_esbuild` | Boolean | False | False | If using esbuild, ensure its required build scripts are run
| `auto_token` | String | | True | Used for publishing the GitHub release and creating labels
| Name | Type | Default | Required | Description |
| ------------- | ------- | ------- | -------- | ----------------------------------------------------------- |
| `use_esbuild` | Boolean | False | False | If using esbuild, ensure its required build scripts are run |
| `auto_token` | String | | True | Used for publishing the GitHub release and creating labels |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/frontend/npm/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
type: string

runs:
using: "composite"
using: 'composite'
steps:
- name: npm_publish_inputs
shell: bash
Expand Down
10 changes: 6 additions & 4 deletions .github/actions/frontend/runtime/e2e_pending_status/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Frontend Runtime - E2E Pending Status

This [composite action](./action.yml) is responsible for reporting that the E2E tests have begun and are pending via a status check in the PR, providing a quick feedback loop for developers.
This [composite action](./action.yml) is responsible for reporting that the E2E
tests have begun and are pending via a status check in the PR, providing a quick
feedback loop for developers.

## Inputs

This action takes the following inputs:

| Name | Type | Default | Required | Description |
| --------------------------- | ------- | ---------------------------- | --------- | --------------------------------------------------------- |
| `github_token` | String | | True | Github access token
| Name | Type | Default | Required | Description |
| -------------- | ------ | ------- | -------- | ------------------- |
| `github_token` | String | | True | Github access token |

## Outputs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
required: true

runs:
using: "composite"
using: 'composite'
steps:
- name: e2e_pr_status_inputs
shell: bash
Expand All @@ -21,4 +21,4 @@ runs:
sha: ${{ steps.get_branch_of_pr.outputs.head_sha }}
token: ${{ inputs.github_token }}
status: pending
context: 'pr / E2E Status'
context: 'pr / E2E Status'
24 changes: 13 additions & 11 deletions .github/actions/frontend/runtime/e2e_prepare/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Frontend Runtime - E2E Prepare

This [composite action](./action.yml) is responsible for executing [Artemis](https://github.com/JupiterOne/artemis) and obtaining the necessary information needed for logging in via the account/user created.
This [composite action](./action.yml) is responsible for executing
[Artemis](https://github.com/JupiterOne/artemis) and obtaining the necessary
information needed for logging in via the account/user created.

## Inputs

This action takes the following inputs:

| Name | Type | Default | Required | Description |
| --------------------------- | ------- | ---------------------------- | --------- | --------------------------------------------------------- |
| `e2e_artemis_config_path` | String | cypress/artemis-config.yaml | False | Used to determine the path to the artemis config file
| `userCount` | String | | False | The number of tests that you want Cypress to run in parallel (obtained via `$(echo '${{ inputs.e2e_containers }}' | jq '. | length')`)
| Name | Type | Default | Required | Description |
| ------------------------- | ------ | --------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | ----- | ---------- |
| `e2e_artemis_config_path` | String | cypress/artemis-config.yaml | False | Used to determine the path to the artemis config file |
| `userCount` | String | | False | The number of tests that you want Cypress to run in parallel (obtained via `$(echo '${{ inputs.e2e_containers }}' | jq '. | length')`) |

## Outputs

This action returns the following outputs:

| Name | Type | Description |
| --------------------------- | ------- | --------------------------------------------------------- |
| `artemis_account_name` | String | The account name extracted from the artemis-run.json file
| `artemis_account_subdomain` | String | The account subdomain extracted from the artemis-run.json file
| `artemis_account_id` | String | The id extracted from the artemis-run.json file
| `artemis_users` | String | The users extracted from the artemis-run.json file
| Name | Type | Description |
| --------------------------- | ------ | -------------------------------------------------------------- |
| `artemis_account_name` | String | The account name extracted from the artemis-run.json file |
| `artemis_account_subdomain` | String | The account subdomain extracted from the artemis-run.json file |
| `artemis_account_id` | String | The id extracted from the artemis-run.json file |
| `artemis_users` | String | The users extracted from the artemis-run.json file |

## Example Usage

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/frontend/runtime/e2e_prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ outputs:
value: ${{ steps.artemis_info.outputs.artemis_users }}

runs:
using: "composite"
using: 'composite'
steps:
- name: e2e_prepare_inputs
shell: bash
Expand Down
69 changes: 49 additions & 20 deletions .github/actions/frontend/runtime/e2e_prepare/test/action.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { MockGithub } from '@kie/mock-github';
import { Act } from '@kie/act-js';
import { getCompositeActionConfig, runCompositeAction } from 'tests/utils/setup';
import {
getCompositeActionConfig,
runCompositeAction,
} from 'tests/utils/setup';
import { getTestResult } from 'tests/utils/helpers';
import { join } from 'node:path';
import artemisRun from './artemis-run.json';
Expand All @@ -10,15 +13,19 @@ const repoName = 'e2e_prepare';
let mockGithub: MockGithub;

beforeEach(async () => {
mockGithub = new MockGithub(getCompositeActionConfig({
directory: __dirname,
repoName,
additionalFiles: [{
src: join(__dirname, 'artemis-run.json'),
dest: 'artemis-run.json',
}]
}));

mockGithub = new MockGithub(
getCompositeActionConfig({
directory: __dirname,
repoName,
additionalFiles: [
{
src: join(__dirname, 'artemis-run.json'),
dest: 'artemis-run.json',
},
],
})
);

await mockGithub.setup();
});

Expand All @@ -30,18 +37,40 @@ test('output of artemis_info returns correct results based off artemis-run.json'
const results = await runCompositeAction({
act: new Act(mockGithub.repo.getPath(repoName)),
repoName,
originDirectory: __dirname
originDirectory: __dirname,
});

const results_artemis_account_name = getTestResult({ results, name: 'results_artemis_account_name' });
const results_artemis_account_subdomain = getTestResult({ results, name: 'results_artemis_account_subdomain' });
const results_artemis_account_id = getTestResult({ results, name: 'results_artemis_account_id' });
const results_artemis_users = getTestResult({ results, name: 'results_artemis_users' });
const results_artemis_account_name = getTestResult({
results,
name: 'results_artemis_account_name',
});
const results_artemis_account_subdomain = getTestResult({
results,
name: 'results_artemis_account_subdomain',
});
const results_artemis_account_id = getTestResult({
results,
name: 'results_artemis_account_id',
});
const results_artemis_users = getTestResult({
results,
name: 'results_artemis_users',
});

expect(results_artemis_account_name.output).toEqual(artemisRun[0].metadata.accountName);
expect(results_artemis_account_subdomain.output).toEqual(artemisRun[0].metadata.accountSubdomain);
expect(results_artemis_account_name.output).toEqual(
artemisRun[0].metadata.accountName
);
expect(results_artemis_account_subdomain.output).toEqual(
artemisRun[0].metadata.accountSubdomain
);
expect(results_artemis_account_id.output).toEqual(artemisRun[0].id);
expect(results_artemis_users.output).toContain(artemisRun[1].metadata.token.tokenSecret);
expect(results_artemis_users.output).toContain(artemisRun[1].metadata.token.tokenCsrf);
expect(results_artemis_users.output).toContain(artemisRun[1].metadata.groupName);
expect(results_artemis_users.output).toContain(
artemisRun[1].metadata.token.tokenSecret
);
expect(results_artemis_users.output).toContain(
artemisRun[1].metadata.token.tokenCsrf
);
expect(results_artemis_users.output).toContain(
artemisRun[1].metadata.groupName
);
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on: [push]

jobs:
e2e_prepare:
runs-on: ubuntu-latest
Expand All @@ -22,4 +22,4 @@ jobs:
shell: bash
- name: results_artemis_users
run: echo ${{ steps.e2e_prepare.outputs.artemis_users }}
shell: bash
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
}
}
}
]
]
Loading

0 comments on commit a05df84

Please sign in to comment.