|
| 1 | +# Contributing |
| 2 | + |
| 3 | +See [AWS Amplify Contributing Guidelines](https://github.com/aws-amplify/.github/blob/master/CONTRIBUTING.md). |
| 4 | + |
| 5 | +## Development |
| 6 | + |
| 7 | +### Getting Started |
| 8 | + |
| 9 | +1. Fork & Clone this repo |
| 10 | +1. [`nvm install`](https://github.com/nvm-sh/nvm) |
| 11 | +1. [`nvm use`](https://github.com/nvm-sh/nvm) |
| 12 | + |
| 13 | +### Building |
| 14 | + |
| 15 | +```sh |
| 16 | +# To run a full build |
| 17 | +npm run setup-dev |
| 18 | + |
| 19 | +# Or, if you'd like to run steps manually |
| 20 | +npm install |
| 21 | +lerna bootstrap |
| 22 | +lerna run build |
| 23 | +``` |
| 24 | + |
| 25 | +### Unit Testing |
| 26 | + |
| 27 | +Unit test are written with [Jest](https://jestjs.io/). |
| 28 | + |
| 29 | +```sh |
| 30 | +# Run tests in all packages |
| 31 | +npm test |
| 32 | +``` |
| 33 | + |
| 34 | +### Integration Testing |
| 35 | + |
| 36 | +Integration tests are done using a [React app](https://github.com/facebook/create-react-app) with |
| 37 | +[Cypress](https://www.cypress.io/). |
| 38 | + |
| 39 | +The integraiton tests verify: |
| 40 | + |
| 41 | +- The correctness of the generated components. |
| 42 | +- The generate functionality in the browser environment. |
| 43 | + |
| 44 | +The `integration-test` GitHub workflow performs these integration tests in CI. |
| 45 | + |
| 46 | +To run integration tests locally, execute the following: |
| 47 | + |
| 48 | +```sh |
| 49 | +npm run integ |
| 50 | +``` |
| 51 | + |
| 52 | +| Command | Description | |
| 53 | +| ----------------------------- | ----------------------------------------------------------------- | |
| 54 | +| npm run integ:setup | Setup integration tests but do not run the tests. | |
| 55 | +| npm run integ:test | Run integration tests on an existing integration setup. | |
| 56 | +| npm run integ:templates | Reload integration templates from test-generator. | |
| 57 | +| npm run integ:templates:watch | Watch for changes to integration templates and reload on changes. | |
| 58 | + |
| 59 | +### Release Process |
| 60 | + |
| 61 | +Until this package is public and publishes to NPM, we have a slightly complicated release process (though mostly automated). |
| 62 | + |
| 63 | +There are 3 keys steps, first you need to create a new tagged release version of the packages which will be used by our dependencies to consume the latest code. After that you'll need to update the CLI repo to point to this new version, and then execute an import script in StudioUI to pull the latest external code into their service. |
| 64 | + |
| 65 | +#### Versioning |
| 66 | + |
| 67 | +1. Create new branch: `git checkout -b new-release` |
| 68 | +1. Run version command: `npm run version` |
| 69 | +1. Create new PR with the new branch to mainline: `gh pr create` |
| 70 | +1. Squash and merge PR after approval. |
| 71 | + Ensure the commit message follows the pattern: `chore(release): v{version_number}`. |
| 72 | + The Release GitHub workflow will not work if the commit message is not formated correctly. |
| 73 | +1. Wait for the [Release GithHub workflow](https://github.com/aws-amplify/amplify-codegen-ui-staging/actions/workflows/release.yml) to complete. |
| 74 | + |
| 75 | +\*\*N.B. Ensure that your release has a tag, manually creating if necessary. Only major/minor updates seem to automatically generate tags, but you can create one yourself with the [git-tag](https://git-scm.com/docs/git-tag) command. |
| 76 | + |
| 77 | +#### Amplify CLI |
| 78 | + |
| 79 | +1. Navigate to the Studio Category repo's [configuration file](https://github.com/johnpc/amplify-category-studio/blob/master/.github/variables/codegenVersion.env) for the codegen version, and update this to point to the version you've just published. |
| 80 | +1. Create new PR for the release with `gh pr create` |
| 81 | +1. Ask the CLI team to merge the PR after approval. |
| 82 | + |
| 83 | +#### Studio UI |
| 84 | + |
| 85 | +1. Pull down the necessary packages to integrate into studio UI. |
| 86 | +1. Execute the 'update-codegen.sh' script, providing the newly created tag. |
| 87 | +1. Ensure review and merge of the CR, after manual verification testing. |
0 commit comments