Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: contribution guide #222

Merged
merged 1 commit into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Contribution Guide can be found [here](https://kryptokrauts.gitbook.io/aepp-sdk-java/contribution-guide)
Contribution Guide can be found [here](docs/contribute.md).
79 changes: 79 additions & 0 deletions docs/contribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# How to contribute?

## Get started

### Prerequisites

- Docker
- Gradle
- [Lombok-Plugin](https://projectlombok.org)

The SDK heavily makes use of the lombok IDE plugin to hide glue code, especially getters, setters, builders and helper methods and helps to keep the classes clean and focus on the logic.
The plugin is needed in your IDE of choice to automatically create the necessary methods in the background.

- [System requirements](index.md#system-requirements)

### Development environment

To run integration tests you need to run the preconfigured docker setup by executing:

- `docker-compose up -d`

You should see the following instances up and running:

| service | description | endpoints |
| --- | --- | --- |
| compiler | Sophia http compiler that is required to compile contracts and to encode/decode calldata | http://localhost:8080 |
| node | æternity node including the middleware plugin | http://localhost:3013 (node external api), http://localhost:3113 (node debug api), http://localhost:3014 (node websocket), http://localhost:4000 (middleware api), http://localhost:4001 (middleware websocket) |
| proxy | nginx proxy to access specific APIs without the need to provide a port | http://localhost (node external & internal api), http://compiler.localhost (compiler), http://mdw.localhost (middleware) |

### Generate API clients

The SDK requires API clients (Compiler, Node & Middelware) that can be generated by executing following Gradle task:

- `gradle generateApiClients`

## Testing
The SDK ships with two kinds of tests:

- **unit tests**, which run independently of a running node
- **integration tests**, which require a running aeternity node

In order to run the integration tests you need to configure the following environment variables:

```sh
AETERNITY_BASE_URL = http://localhost
COMPILER_BASE_URL = http://localhost:3080
MDW_BASE_URL = http://localhost:4000
```

The tests can be run within your IDE of choice by using the following Gradle tasks:

```sh
gradle test
gradle integrationTest
```

Integration tests should extend the `BaseTest` class which provides some convenient methods for running tests using the underlying vertx framework.
Test methods can thus make use of the `executeTest` method as follows:

```
@Test
public void testMyLogic(TestContext context) {
this.executeTest(
context,
t -> {
...
context.assertEquals("test", "test");
...
});
}
```

## Code format
Before committing code you should make sure the code follows the Google Java Style. This can be done by executing:

- `gradle googleJavaFormat`

## Pull requests
Please provide a pull request to the latest development branch, e.g. `3.x`. We will review and merge or request some changes if neccesary. Make sure that the PR passes all the checks!
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ nav:
- PayingForTx: usage-guides/payingfortx.md
- Example applications: example-apps.md
- Javadoc: https://www.javadoc.io/doc/com.kryptokrauts/aepp-sdk-java
- Changelog: changelog.md
- Changelog: changelog.md
- Contribute: contribute.md