# Continuous Integration

***

A GitHub Action is available for integrating `era-test-node` into your CI/CD environments. This action offers high configurability and streamlines the process of testing your applications in an automated way.

You can find the GitHub Action available in the [marketplace](https://github.com/marketplace/actions/era-test-node-action).

In CI tests, use `127.0.0.1` as the URL in hardhat.config.ts or for the provider to avoid '**Cannot connect to network**' errors.

### Configuration Options <a href="#configuration-options" id="configuration-options"></a>

| Option            | Description                 | Required | Default                    | Options                                                                   |
| ----------------- | --------------------------- | -------- | -------------------------- | ------------------------------------------------------------------------- |
| `mode`            | Operation mode.             | No       | `run`                      | `run`, `fork`                                                             |
| `network`         | Network selection.          | No       | -                          | -                                                                         |
| `forkAtHeight`    | Block height to fork at.    | No       | -                          | -                                                                         |
| `port`            | Listening port.             | No       | `8011`                     | -                                                                         |
| `showCalls`       | Call debug visibility.      | No       | `none`                     | `none`, `user`, `system`, `all`                                           |
| `showStorageLogs` | Storage log visibility.     | No       | `none`                     | `none`, `read`, `write`, `all`                                            |
| `showVmDetails`   | VM details visibility.      | No       | `none`                     | `none`, `all`                                                             |
| `showGasDetails`  | Gas details visibility.     | No       | `none`                     | `none`, `all`                                                             |
| `resolveHashes`   | Enable hash resolution.     | No       | `false`                    | -                                                                         |
| `log`             | Log filter level.           | No       | `info`                     | `debug`, `info`, `warn`, `error`                                          |
| `logFilePath`     | Path for the log file.      | No       | `era_test_node.log`        | -                                                                         |
| `target`          | Target architecture.        | No       | `x86_64-unknown-linux-gnu` | `x86_64-unknown-linux-gnu`, `x86_64-apple-darwin`, `aarch64-apple-darwin` |
| `version`         | Version of `era_test_node`. | No       | `latest`                   | -                                                                         |

***

### Examples <a href="#examples" id="examples"></a>

The following are examples of configuration for your GitHub Action.

#### Quickstart <a href="#quickstart" id="quickstart"></a>

```yaml
name: Run Era Test Node Action

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run Era Test Node
        uses: dutterbutter/era-test-node-action@latest
```

#### Advanced <a href="#advanced" id="advanced"></a>

With configuration options:

```yaml
name: Run Era Test Node Action

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run Era Test Node
        uses: dutterbutter/era-test-node-action@latest
        with:
          mode: "run"
          showCalls: "user"
          showStorageLogs: "read"
          showVmDetails: "all"
          showGasDetails: "all"
          resolveHashes: "true"
          log: "info"
          logFilePath: "era_test_node.log"
          target: "x86_64-unknown-linux-gnu"
```

With upload log file to artifacts:

```yaml
name: Run Era Test Node Action

on:
  pull_request:
    branches: [main]
  workflow_dispatch:
jobs:
  test:
    name: unit-tests
    strategy:
      matrix:
        platform: [ubuntu-latest]
    runs-on: ${{ matrix.platform }}

    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Run Era Test Node
        uses: dutterbutter/era-test-node-action@latest
        with:
          mode: "fork"
          network: "mainnet"
          forkAtHeight: "1855248"
          showCalls: "user"
          showStorageLogs: "read"
          showVmDetails: "all"
          showGasDetails: "all"
          resolveHashes: "true"
          log: "info"
          logFilePath: "era_test_node.log"
          target: "x86_64-unknown-linux-gnu"
          releaseTag: "latest"

      - name: Install Dependencies
        run: yarn install

      - name: Run Tests
        run: |
          yarn test:contracts

      - name: Upload era_test_node log
        uses: actions/upload-artifact@v3
        with:
          name: era_test_node-log
          path: era_test_node.log
```

With Fork:

```yaml
name: Run Era Test Node Action

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run Era Test Node
        uses: dutterbutter/era-test-node-action@latest
        with:
          mode: "fork"
          network: "mainnet"
          forkAtHeight: "1855248"
          showCalls: "user"
          showStorageLogs: "read"
          showVmDetails: "all"
          showGasDetails: "all"
          resolveHashes: "true"
          log: "info"
          logFilePath: "era_test_node.log"
          target: "x86_64-unknown-linux-gnu"
          releaseTag: "latest"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://validium.gitbook.io/docs/test-and-debug/continuous-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
