Skip to content
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
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

.env
.vscode
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
TEST_TARGET_NETWORK: localnet
RECALL_PRIVATE_KEY: "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97"
DO_NOT_TRACK: 1
DAGGER_NO_NAG: 1
# TODO: Use the latest localnet image once it can build with the latest IPC code
LOCALNET_IMAGE: "textile/recall-localnet:sha-dc4da8c-3e80bf0"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down Expand Up @@ -46,25 +46,17 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

# Cache Dagger volumes
- name: Cache Dagger volumes
uses: actions/cache@v3
with:
path: |
~/.cache/dagger
key: ${{ runner.os }}-dagger-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: make build

- name: Run tests
uses: dagger/dagger-for-github@8.0.0
with:
version: '0.18.1'
version: '0.18.2'
workdir: 'dagger'
verb: call
module: ci
args: test --source ../ --docker-username $DOCKER_USERNAME --docker-password env://DOCKER_PASSWORD --recall-private-key env://RECALL_PRIVATE_KEY
args: test --source ../ --localnet-image "$LOCALNET_IMAGE" --docker-username "$DOCKER_USERNAME" --docker-password env://DOCKER_PASSWORD 2>&1 | grep -vi -E "resolve|containerd|libnetwork|client|daemon|checkpoint|task|^$"
dagger-flags: '--progress plain'

- name: Run linter
Expand Down
17 changes: 15 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["cli", "provider", "sdk", "signer"]
members = ["cli", "provider", "sdk", "signer", "tests/sdk"]
resolver = "2"

[workspace.package]
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ docker run --privileged --rm --name recall-localnet \

If you'd like to test against a specific IPC commit, look for the corresponding `localnet` image in the
[Docker Hub repository](https://hub.docker.com/r/textile/recall-localnet/tags) using the first 7 characters of the IPC
commit hash. For example, for commit `8c6792f5c306420a6915e9a83fefb10520417a8b`, the corresponding `localnet` image
would be tagged `sha-8c6792f-*` (in this case, `sha-8c6792f-be1693d`). You can then run the following command:
commit hash. For example, for commit `dc4da8c14c541e1ef9e398a594e65660465c47f5`, the corresponding `localnet` image
would be tagged `sha-dc4da8c-*` (in this case, `sha-dc4da8c-3e80bf0`). You can then run the following command:

```bash
docker run --privileged --rm -d --name recall-localnet \
-p 8545:8545 \
-p 8645:8645 \
-p 26657:26657 \
textile/recall-localnet:sha-8c6792f-be1693d
textile/recall-localnet:sha-dc4da8c-3e80bf0
```

Note that it can take several minutes for the `localnet` container to start up and be ready for testing. You can check
Expand All @@ -103,25 +103,25 @@ The following logs should appear when the container is ready:
All containers started. Waiting for termination signal...
```

Also note that some tests (e.g. the SDK tests) require additional environment variables to be set. You can set these
environment variables in your shell before running the tests. For example, you can run the following command:
### Extracting Network Config

To extract the network config from the `localnet` container, you can run the following command:

```bash
export RECALL_PRIVATE_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
docker exec -it recall-localnet bash -c "cat /workdir/localnet-data/networks.toml"
```

Add the `localnet` configuration to your `~/.config/recall/networks.toml` file.

### Adding New Integration Tests

All the tests in the repo are written as Rust unit tests, even the integration tests. New integration tests can be added
to the `sdk/tests` directory. The tests are run using the `cargo test` command, but note that you will need to set the
`RECALL_PRIVATE_KEY` environment variable and start the `localnet` container before running the tests.
to the `sdk/tests` directory.

### Adding New CLI Tests

CLI tests are currently bash scripts located in the `dagger/ci/cli-tests` directory. These tests are run through the
[CI pipeline](./dagger/README.md) and run against a `localnet` Docker image launched through Dagger. You can add new
tests by creating a new bash script in this directory. The test scripts are numbered to ensure a deterministic order of
execution.
CLI tests are currently bash scripts located in the `tests/cli` directory. You can add new tests by creating a new bash
script in this directory. The test scripts are numbered to ensure a deterministic order of execution.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ fn apply_flags_on_network_spec(mut spec: NetworkSpec, cli: &Cli) -> NetworkSpec
spec.subnet_config.evm_registry_address = x;
}

if let Some(parent) = spec.parent_config.as_mut() {
if let Some(parent) = spec.parent_network_config.as_mut() {
if let Some(ref x) = cli.parent_evm_rpc_url {
parent.evm_rpc_url = x.clone();
}
Expand Down
42 changes: 33 additions & 9 deletions dagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ This module contains the code for the Recall CI pipeline. It uses [Dagger](https
Recall CLI and SDK tests against a `localnet` Docker image. It can be run identically both locally and in CI.

## Prerequisites
- [Dagger](https://dagger.io/docs/install) installed
- [Dagger](https://docs.dagger.io/install) installed
- [Docker](https://docs.docker.com/get-docker/) installed and running
- [Golang](https://golang.org/doc/install) installed (for `dagger` CLI)

## Initializing the pipeline

Expand All @@ -24,15 +23,40 @@ To run the pipeline, use the following command:
```bash
DAGGER_NO_NAG=1 \
DO_NOT_TRACK=1 \
RECALL_PRIVATE_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \
DOCKER_PASSWORD=[password] \
dagger call test --progress plain \
--source ../ \
2>&1 | grep -vi -E "resolve|containerd|libnetwork|client|daemon|checkpoint|task|^$"
```

The `grep` command is used to filter out some of the Dagger output that is not relevant to the pipeline. You can remove
it if you want to see all the output.

### Specifying Docker Credentials

Docker credentials can optionally be passed in to avoid throttling issues with Docker Hub:

```bash
DAGGER_NO_NAG=1 \
DO_NOT_TRACK=1 \
dagger call test --progress plain \
--docker-username [username] \
--source ../ \
--docker-username $DOCKER_USERNAME \
--docker-password env://DOCKER_PASSWORD \
--recall-private-key env://RECALL_PRIVATE_KEY \
--source ../
2>&1 | grep -vi -E "resolve|containerd|libnetwork|client|daemon|checkpoint|task|^$"
```

Docker credentials are passed in to avoid throughput issues with Docker Hub. These can be made optional in a future PR.
### Specifying the Localnet Docker image

The `RECALL_PRIVATE_KEY` environment variable is for one of the wallets created by `anvil`.
The pipeline uses the latest `textile/recall-localnet` Docker image by default. If you want to use a different image,
perhaps a locally built one, you can specify it using the `--localnet-image` flag:

```bash
DAGGER_NO_NAG=1 \
DO_NOT_TRACK=1 \
dagger call test --progress plain \
--source ../ \
--localnet-image "textile/recall-localnet:sha-dc4da8c-3e80bf0" \
--docker-username $DOCKER_USERNAME \
--docker-password env://DOCKER_PASSWORD \
2>&1 | grep -vi -E "resolve|containerd|libnetwork|client|daemon|checkpoint|task|^$"
```
3 changes: 0 additions & 3 deletions dagger/ci/cli-tests/00-account-deposit.sh

This file was deleted.

Loading
Loading