Skip to content

feat: add the autogen tool to easily add e2e tests and run it for the first time & fix copyFrom #566

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

Merged
merged 1 commit into from
Sep 12, 2024
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: 14 additions & 0 deletions .github/workflows/autogen/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
env:
browser: true
es2021: true
extends: standard
parserOptions:
ecmaVersion: latest
sourceType: module
overrides:
- files: ["*.mjs"]
parserOptions:
ecmaVersion: latest
sourceType: module
rules:
"no-template-curly-in-string": "off"
42 changes: 42 additions & 0 deletions .github/workflows/autogen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Solo autogen tool

## Description

The Solo autogen tool is used to add e2e test cases that need to be ran independently as their own job into the GitHub workflows and into the solo package.json

## Usage

from solo root directory:
```bash
cd .github/workflows/autogen
npm install
npm run autogen
```

Use git to detect file changes and validate that they are correct.

The templates need to be maintained, you can either make changes directly to the templates and then run the tool, or make changes in both the workflow yaml files and the templates. Should the templates fall out of sync, then you can update the templates so that when autogen runs again, the git diff will better match.
```bash
template.flow-build-application.yaml
template.flow-pull-request-checks.yaml
template.zxc-code-analysis.yaml
template.zxc-env-vars.yaml
```
For new e2e test jobs update the `<solo-root>/.github/workflows/templates/config.yaml`, adding a new item to the tests object with a name and jestPostfix attribute.

NOTE: IntelliJ copy/paste will alter the escape sequences, you might have to manually type it in, clone a line, or use an external text editor.

e.g.:
```yaml
- name: Mirror Node
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/mirror_node\\.test\\.mjs\"

```

## Development

To run lint fix:
```bash
cd .github/workflows/autogen
eslint --fix .
```
20 changes: 20 additions & 0 deletions .github/workflows/autogen/autogen.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node
/**
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* 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.
*
*/
import * as fnm from './src/index.mjs'

fnm.main(process.argv)
Loading
Loading