github.com/facebookincubator/ttpforge@v1.0.13-0.20240405153150-5ae801628835/docs/dev/README.md (about)

     1  # Getting started as a developer
     2  
     3  To get involved with this project,
     4  [create a fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
     5  and follow along.
     6  
     7  ---
     8  
     9  ## Install Golang
    10  
    11  TTPForge is tested and built in
    12  [Github Actions](https://github.com/features/actions) using the Golang version
    13  from this configuration file:
    14  
    15  https://github.com/facebookincubator/TTPForge/blob/main/.github/workflows/tests.yaml
    16  
    17  It is recommended to use the same version when developing locally. You can
    18  install this Golang version from the official Golang
    19  [website](https://go.dev/doc/install).
    20  
    21  ## Testing and Building TTPForge
    22  
    23  With the appropriate Golang version installed as per the instructions above, you
    24  can now run our unit tests:
    25  
    26  ```bash
    27  go test ./...
    28  ```
    29  
    30  and subsequently build your own copy of the TTPForge binary:
    31  
    32  ```bash
    33  go build -o ttpforge
    34  ```
    35  
    36  Finally, you can run our integration tests against your binary with the command:
    37  
    38  ```bash
    39  ./integration_tests.sh ./ttpforge
    40  ```
    41  
    42  ## Github Actions CI/CD
    43  
    44  When you submit your change as a pull request to our repository, a variety of
    45  linting and testing workflows will be triggered. If you wish to run any of these
    46  workflows locally to fix a failure, you can do so with the
    47  [act](https://github.com/nektos/act) tool. For example, you can run the
    48  markdownlint action as follows:
    49  
    50  ```bash
    51  act -W .github/workflows/markdownlint.yaml
    52  ```
    53  
    54  ## Running Pre-Commit Locally
    55  
    56  Several of the linters in this project may be used as pre-commit hooks if
    57  desired - you can install and setup pre-commit according to the
    58  [official instructions](https://pre-commit.com/).
    59  
    60  For quick ad hoc runs, you may wish to run pre-commit in a virtual environment:
    61  
    62  ```bash
    63  python3 -m venv venv
    64  . venv/bin/activate
    65  pip3 install pre-commit
    66  pre-commit run --all-files
    67  ```
    68  
    69  You can also run pre-commit locally using `act`, as described in the previous
    70  section.