github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/docs/contributing.md (about)

     1  # Contibuting to Fabrikate
     2  
     3  We do not claim to have all the answers and would gratefully appreciate
     4  contributions. This document covers everything you need to know to contribute to
     5  Fabrikate.
     6  
     7  ## Issues and Feature Requests
     8  
     9  This project tracks issues exclusively via our project on Github: please
    10  [file issues](https://github.com/microsoft/fabrikate/issues/new/choose) there.
    11  
    12  Please do not ask questions via Github issues. Instead, please
    13  [join us on Slack](https://join.slack.com/t/bedrockco/shared_invite/enQtNjIwNzg3NTU0MDgzLWRiYzQxM2ZmZjQ2NGE2YjA2YTJmMjg3ZmJmOTQwOWY0MTU3NDVkNDJkZDUyMDExZjIxNTg5NWY3MTI3MzFiN2U)
    14  and ask there.
    15  
    16  For issues and feature requests, please follow the general format suggested by
    17  the template. Our core team working on Fabrikate utilizes agile development and
    18  would appreciate feature requests phrased in the form of a
    19  [user story](https://www.mountaingoatsoftware.com/agile/user-stories), as this
    20  helps us understand better the context of how the feature would be utilized.
    21  
    22  ## Pull Requests
    23  
    24  Every pull request should be matched with a Github issue. If the pull request is
    25  substantial enough to include newly designed elements, this issue should
    26  describe the proposed design in enough detail that we can come to an agreement
    27  before effort is applied to build the feature. Feel free to start conversations
    28  on our Slack #fabrikate channel to get feedback on a design.
    29  
    30  When submitting a pull request, please reference the issue the pull request is
    31  intended to solve via "Closes #xyz" where is the issue number that is addressed.
    32  
    33  ## Cloning Fabrikate
    34  
    35  If you intend to make contributions to Fabrikate (versus just build it), the
    36  first step is to
    37  [fork Fabrikate on Github](https://github.com/microsoft/fabrikate) into your own
    38  account.
    39  
    40  Fabrikate comes with a development container for 
    41  [Visual Studio Code](https://code.visualstudio.com/docs/remote/containers).
    42  
    43  > Note: If you do not want to use the development container, ensure you have 
    44  go version >= 1.12. Fabrikate uses 
    45  [go modules](https://github.com/golang/go/wiki/Modules), so either git clone
    46  your fork outside of the `GOPATH` or set `GO111MODULE=on` if you want to work 
    47  within the `GOPATH`.
    48  
    49  To use the development container:
    50  1. Install Microsoft's 
    51  [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
    52  2. Git clone your fork of the repo.
    53  3. Open the project in VSCode.
    54  4. In the command palette (`ctrl+shift+p` on Windows/Linux, `command+shift+p` on Mac), 
    55  select "Reopen in Container".
    56  5. In the command palette type: "Go: Install/Update Tools" and select all.
    57  6. When all tools are finished installing, in the command palette type: "Developer: Reload Window".
    58  
    59  ## Building Fabrikate
    60  
    61  From the root of the project (which if you followed the instructions above
    62  should be `$GOPATH/microsoft/fabrikate`), first fetch project dependencies with:
    63  
    64  ```sh
    65  $ scripts/build get-deps
    66  ```
    67  
    68  Note: to run tests, you will need to run `scripts/build get-deps` to install
    69  test dependencies.
    70  
    71  You can then build a Fabrikate executable with:
    72  
    73  ```sh
    74  $ scripts/build build fab
    75  ```
    76  
    77  To build a complete set of release binaries across supported architectures, use
    78  our build script, specifying a version number of the release:
    79  
    80  ```sh
    81  $ scripts/build build release 0.5.0
    82  ```
    83  
    84  ## Testing Fabrikate
    85  
    86  Fabrikate utilizes test driven development to maintain quality across commits.
    87  Every code contribution requires covering tests to be accepted by the project
    88  and every pull request is built by CI/CD to ensure that the tests pass and that
    89  the code is lint free.
    90  
    91  You can run project tests by executing the following commands:
    92  
    93  ```sh
    94  $ go test -v -race ./...
    95  ```
    96  
    97  And run the linter with:
    98  
    99  ```sh
   100  $ golangci-lint run
   101  ```
   102  
   103  ## Debugging Fabrikate
   104  
   105  To debug Fabrikate on [Visual Studio Code](https://code.visualstudio.com/):
   106  
   107  1. Open `main.go`
   108  2. On the top menu select Debug > Start Debugging
   109  3. It will prompt you to create a `launch.json` file for the go language,
   110     proceed to create it.
   111  4. Update the configuration to debug specific `fabrikate` commands. Follow the
   112     instructions below.
   113  
   114  ### Debug Configuration
   115  
   116  Initially the debug configuration will look like this:
   117  
   118  ```json
   119   "configurations": [
   120          {
   121              "name": "Launch",
   122              "type": "go",
   123              "request": "launch",
   124              "mode": "auto",
   125              "program": "${fileDirname}",
   126              "env": {},
   127              "args": []
   128          }
   129      ]
   130  ```
   131  
   132  You can specify what `fabrikate` commands you want to debug in the arguments.
   133  Below are some examples.
   134  
   135  To debug the `install` command:
   136  
   137  ```
   138  "args": ["install", "/home/edaena/Source/repos/sample-component"]
   139  ```
   140  
   141  To debug the `generate` command:
   142  
   143  ```
   144   "args": ["generate", "common"]
   145  ```
   146  
   147  ### Run the Debugger
   148  
   149  For information about how to add breakpoints to the code and more detailed
   150  instructions on debugging refer to
   151  [Visual Studio Code Debugging](https://code.visualstudio.com/docs/editor/debugging).
   152  
   153  1. Go to the `main.go` file
   154  2. On the top menu select Debug > Start Debugging
   155  
   156  ## Contributing
   157  
   158  This project welcomes contributions and suggestions. Most contributions require
   159  you to agree to a Contributor License Agreement (CLA) declaring that you have
   160  the right to, and actually do, grant us the rights to use your contribution. For
   161  details, visit https://cla.microsoft.com.
   162  
   163  When you submit a pull request, a CLA-bot will automatically determine whether
   164  you need to provide a CLA and decorate the PR appropriately (e.g., label,
   165  comment). Simply follow the instructions provided by the bot. You will only need
   166  to do this once across all repos using our CLA.
   167  
   168  This project has adopted the
   169  [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
   170  For more information see the
   171  [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
   172  contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
   173  additional questions or comments.