Skip to content

Commit

Permalink
Merge branch 'refactor/nodekit' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed Jan 7, 2025
2 parents 691972c + f9ca676 commit 549e031
Show file tree
Hide file tree
Showing 198 changed files with 15,454 additions and 2,237 deletions.
16 changes: 0 additions & 16 deletions .docker/start_all.sh

This file was deleted.

49 changes: 0 additions & 49 deletions .docker/start_dev.sh

This file was deleted.

41 changes: 0 additions & 41 deletions .docker/start_empty.sh

This file was deleted.

46 changes: 0 additions & 46 deletions .docker/start_fast_catchup.sh

This file was deleted.

20 changes: 4 additions & 16 deletions .github/workflows/test.yaml → .github/workflows/code_test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Code Tests

on:
pull_request:
Expand All @@ -16,18 +16,6 @@ jobs:
with:
go-version: 1.22

- name: setup .algorun.yaml
run: |
touch .algorun.yaml
echo 'server: http://localhost:8080' >> .algorun.yaml
echo 'token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' >> .algorun.yaml
- name: Start Docker Compose
run: docker compose up -d

- name: Wait for the server to start
run: npx wait-on tcp:8080

- name: Install dependencies
run: go get .

Expand All @@ -53,10 +41,10 @@ jobs:
run: go vet ./...

- name: Build
run: go build -o bin/algorun *.go
run: go build -o bin/nodekit *.go

- name: Test with the Go CLI
run: go test ./... -coverprofile=./coverage.txt -covermode=atomic -coverpkg=./...
- name: Unit Tests
run: make test

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/node_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
## This is a temporary flow, until we have our custom docker images that work with systemd for linux.
## Once we have that, we can remove this and use docker containers in parallel, covering the various OS:es.

name: Node Command OS-Matrix Test

on:
workflow_dispatch:
pull_request:
paths:
- "cmd/**"

jobs:
ubuntu:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Run Ubuntu commands
run: |
export GOCOVERDIR=$(pwd)/coverage
mkdir -p $GOCOVERDIR
go build -cover .
./nodekit install
systemctl status algorand.service
export TOKEN=$(cat /var/lib/algorand/algod.admin.token)
curl http://localhost:8080/v2/participation -H "X-Algo-API-Token: $TOKEN" | grep "null"
./nodekit stop
./nodekit upgrade
./nodekit debug
sleep 10
./nodekit catchup
./nodekit catchup debug
./nodekit catchup stop
./nodekit stop
./nodekit uninstall
go tool covdata textfmt -i=$GOCOVERDIR -o coverage.txt
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

macos:
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Go
run: brew install go

- name: Run MacOs commands
run: |
export GOCOVERDIR=$(pwd)/coverage
mkdir -p $GOCOVERDIR
go build -cover .
./nodekit install
sudo launchctl print system/com.algorand.algod
sleep 5
export TOKEN=$(cat ~/.algorand/algod.admin.token)
curl http://localhost:8080/v2/participation -H "X-Algo-API-Token: $TOKEN" | grep "null"
./nodekit stop
./nodekit upgrade
./nodekit debug
sleep 10
./nodekit catchup
./nodekit catchup debug
./nodekit catchup stop
./nodekit stop
./nodekit uninstall
go tool covdata textfmt -i=$GOCOVERDIR -o coverage.txt
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
algorun-tui
nodekit
coverage
bin
.data

Expand All @@ -15,6 +16,9 @@ bin
# Test binary, built with `go test -c`
*.test

# coverage.txt, in case you run tests locally
coverage.txt

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

Expand All @@ -32,4 +36,4 @@ go.work.sum
.env

# user-created file
.algorun.y*ml
.nodekit.y*ml
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ A guide on how to contribute to this project.
Clone the project

```bash
git clone [email protected]:algorandfoundation/algorun-tui.git
git clone [email protected]:algorandfoundation/nodekit.git
```

Change to the directory

```bash
cd algorun-tui
cd nodekit
```

Build the project
Expand All @@ -29,7 +29,7 @@ Optionally, run a sandboxed participation node
docker compose up
```

Create a configuration file for the participation node in the root directory of the project (.algorun.yaml)
Create a configuration file for the participation node in the root directory of the project (.nodekit.yaml)

```yaml
algod-endpoint: http://localhost:8080
Expand All @@ -40,13 +40,13 @@ Launch the TUI
> [!NOTE]
> If you skipped the docker container or config file, try running `./bin/algorun` standalone,
> If you skipped the docker container or config file, try running `./bin/nodekit` standalone,
> which will detect your algorand data directory from the `ALGORAND_DATA` environment variable that works for `goal`.
> Otherwise, provide the `--algod-endpoint` and `--algod-token` arguments so that it can find your node.
> Note that algorun requires the admin algod token.
> Note that nodekit requires the admin algod token.

```bash
./bin/algorun
./bin/nodekit
```

# 📂 Folder Structure
Expand All @@ -67,7 +67,7 @@ All submodules and endpoints **SHOULD** align with the command/ui namespaces.
Example Command:

```bash
algorun status
nodekit status
```

Example Structure
Expand Down
31 changes: 0 additions & 31 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build:
CGO_ENABLED=0 go build -o bin/algorun *.go
CGO_ENABLED=0 go build -o bin/nodekit .
test:
go test -coverpkg=./... -covermode=atomic ./...
go test -coverprofile=coverage.out -coverpkg=./... -covermode=atomic ./...
generate:
oapi-codegen -config generate.yaml https://raw.githubusercontent.com/algorand/go-algorand/v3.26.0-stable/daemon/algod/api/algod.oas3.yml
Loading

0 comments on commit 549e031

Please sign in to comment.