|
| 1 | +# How To Contribute |
| 2 | + |
| 3 | +## Installation |
| 4 | + |
| 5 | +- `git clone https://github.com/jelhan/create-github-actions-setup-for-ember-addon.git` |
| 6 | +- `cd create-github-actions-setup-for-ember-addon` |
| 7 | +- `yarn install` |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +GitHub Actions CI workflow is created based on a template writen in [EJS](https://ejs.co/). |
| 12 | +It's located in `templates/.github/workflows/ci.yml`. |
| 13 | + |
| 14 | +A configuration object is used to generate a concrete workflow based on the |
| 15 | +template. It is defined by `ConfigurationInterface`. |
| 16 | + |
| 17 | +The data used is extracted from existing configuration files in the project. |
| 18 | +The utility functions responsible for parsing existing configurations are |
| 19 | +called parser. They are located in `src/parser/`. So far only TravisCI |
| 20 | +configuration (`.travis.yml`) is supported. |
| 21 | + |
| 22 | +If no configuration file supported by any available parser is found, default |
| 23 | +values are used. |
| 24 | + |
| 25 | +## Running latest development |
| 26 | + |
| 27 | +The project is written in TypeScript. To use latest development you must first |
| 28 | +compile the code to JavaScript. Run `yarn compile` to do so. |
| 29 | + |
| 30 | +Afterwards you can run latest development on any project. To do so change |
| 31 | +current working directory to the project and afterwards execute the script |
| 32 | +using a local path: |
| 33 | +`/path/to/create-github-actions-setup-for-ember-addon/bin/create-github-actions-setup-for-ember-addon` |
| 34 | + |
| 35 | +## Linting |
| 36 | + |
| 37 | +The project uses ESLint for linting and Prettier for code formatting. Prettier |
| 38 | +is integrated as an ESLint plugin. |
| 39 | + |
| 40 | +Execute `yarn lint` to run linting and `yarn lint --fix` to automatically fix |
| 41 | +linting issues. The latter is especially helpful to prettify the code. |
| 42 | + |
| 43 | +## Running tests |
| 44 | + |
| 45 | +The tests are executed with `yarn test`. The command also takes care of |
| 46 | +compiling the TypeScript to JavaScript before executing the script. |
| 47 | + |
| 48 | +The Tests are written with [jest](https://jestjs.io/). |
| 49 | + |
| 50 | +The tests use [snapshot testing](https://jestjs.io/docs/en/snapshot-testing). |
| 51 | +A snapshot of the created GitHub Actions CI workflow is created for each test |
| 52 | +scenario. It's compared against snapshots created before. The snapshots are |
| 53 | +checked into the repository and located at `tests/acceptance/__snapshots__`. |
| 54 | + |
| 55 | +The snaphot-based tests are expected to fail whenever the created GitHub |
| 56 | +Actions CI workflow changes. In many cases that changes may be expected. If so |
| 57 | +the snapshots must be updated. Run `yarn test -u` to do so. |
| 58 | + |
| 59 | +Please double check that all changes to snapshots are as expected by your |
| 60 | +change before committing the changes. |
0 commit comments