github.com/replicatedcom/ship@v0.50.0/CONTRIBUTING.md (about)

     1  Contributing
     2  =============
     3  
     4  This is a living document and is to be expanded.
     5  As of its initial writing, this document's main goal is to create a home for intructions pertaining to building and running the project.
     6  
     7  Issues
     8  ------------------------
     9  
    10  Pull Requests
    11  ------------------------
    12  
    13  All pull requests must be made from forks enabled on CircleCI, so that unit and acceptance tests can be executed prior to code being merged.
    14  
    15  Changelog descriptions should be in the present tense, such as 'Fix a bug that made everything explode' or 'Add a magical new feature'.
    16  
    17  ### Getting CircleCI to run your tests
    18  
    19  You'll need to enable your fork in CircleCI (under `Add Projects`).
    20  You'll also need to [enable build processing](https://circleci.com/docs/2.0/build-processing/).
    21  Finally, add an environment variable `GITHUB_TOKEN` to the CircleCI project to allow `integration_init` to complete successfully.
    22  This token requires no permissions and is used to avoid GitHub request ratelimits.
    23  You can generate one [here](https://github.com/settings/tokens).
    24  
    25  Build & Run the Project
    26  ------------------------
    27  
    28  ### Prerequisites
    29  
    30  The following tools must be installed before the project can be built.
    31  The specified version are recommended.
    32  
    33  - `yarn` version 1.12
    34  - `node` version 8.11
    35  - `go` version 1.12
    36  - `dep` version 0.5 (https://github.com/golang/dep#installation)
    37  
    38  ### First time build
    39  
    40  Run the following commands before building ship for the first time:
    41  
    42  ```
    43  ./hack/get_build_deps.sh
    44  make deps
    45  ```
    46  
    47  To build ship executable, run
    48  
    49  ```
    50  make bin/ship
    51  ```
    52  
    53  To rebuild everything, including tests, run
    54  
    55  ```
    56  make build
    57  ```
    58  
    59  ### Running
    60  
    61  To run locally-built copy of ship, use
    62  
    63  ```
    64  ./bin/ship init <chart-path>
    65  ```
    66  
    67  for example,
    68  
    69  ```
    70  ./bin/ship init github.com/helm/charts/stable/nginx-ingress
    71  ```
    72  
    73  ### Writing tests
    74  
    75  Tests make extensive use of mocks.
    76  To add mocks for new types, the type needs to be added to the `mockgen` target in the make file.
    77  The following command will generate new mocks and update existing ones:
    78  
    79  ```
    80  make mockgen
    81  ```
    82  
    83  ### Using the UI
    84  
    85  A webpack development server can be started for iterating on the ui with the following command:
    86  
    87  ```
    88  make -C web serve_ship
    89  ```
    90  
    91  The go binary serves the UI on `localhost:8800`, the webpack dev server will serve on `localhost:8880`.
    92  
    93  ### A note on node modules
    94  On rare occasions, node modules may need to be refreshed.
    95  If `make build` results in an error of the following flavor:
    96  ```
    97  ...
    98  make[1]: *** [.state/build_ship] Error 2
    99  make: *** [build-ui] Error 2
   100  ```
   101  and/or if `make -C web serve_ship` gives results in a `Failed to compile` error, the following commands should get everything back up and running.
   102  From the root of the project:
   103  ```
   104  cd web
   105  rm -rf node_modules
   106  yarn
   107  ```