Skip to content

Commit 11c54a7

Browse files
authored
Update Taskfile (#460)
* add install deps to task file * gha updated to use task file Signed-off-by: Jordan Rash <[email protected]>
1 parent fe8a11c commit 11c54a7

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

.github/workflows/schema_generation.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,14 @@ jobs:
1818
uses: actions/setup-go@v4
1919
with:
2020
go-version: '1.23' # Specify your Go version
21-
22-
- name: Install Protoc
21+
22+
- name: Install Taskfile
2323
run: |
24-
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
25-
sudo unzip protoc-28.3-linux-x86_64.zip -d /usr/local
26-
rm protoc-28.3-linux-x86_64.zip
24+
go install github.com/go-task/task/v3/cmd/task@latest
2725
28-
- name: Install dependencies
26+
- name: Install Dependencies
2927
run: |
30-
go install github.com/go-task/task/v3/cmd/task@latest
31-
go install github.com/atombender/go-jsonschema@latest
32-
go install google.golang.org/protobuf/cmd/[email protected]
28+
task install-deps
3329
3430
- name: Run 'task gen-schema'
3531
run: |

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,37 @@
1212
Leverage and extend your investment in NATS infrastructure to deploy functions and services, turning NATS into the ultimate platform for building distributed applications.
1313

1414
## Prerequisites
15+
1516
### Taskfile
17+
1618
Nex uses [Task](https://taskfile.dev) for building, testing, and releasing. You can install Task by following the
1719
instructions [here](https://taskfile.dev/installation)
1820

19-
### Protobuf
20-
Nex relies on Protobuf for defining the API and messages. While many linux distros have Protobuf available in their
21-
package repositories, it is recommended to install the latest version from the official releases. You can find the
21+
### Protobuf | Go-jsonschema
22+
23+
Nex relies on Protobuf and Go-jsonschema for defining the API and messages. While many linux distros have Protobuf available in their
24+
package repositories, it is recommended to install the version matching what is defined in CI from the official releases. You can find the
2225
latest release [here](https://github.com/protocolbuffers/protobuf/releases)
2326

24-
On linux, once downloaded, you can extract the archive and run the following commands to install it:
25-
```shell
26-
unzip protoc-xxx.zip -d protoc3
27-
sudo cp protoc3/bin/* /usr/local/bin/
28-
sudo cp protoc3/include/* /usr/local/include/
29-
```
27+
The included Taskfile has a task defined for downloading and installing the required dependencies.
3028

31-
Also make sure to install `protoc-gen-go` by running:
3229
```shell
33-
go install google.golang.org/protobuf/cmd/protoc-gen-go
30+
task install-deps
3431
```
3532

36-
### Go-jsonschema
37-
Nex uses go-jsonschema for validating the configuration files. You can install it by [following the installation instructions](https://github.com/omissis/go-jsonschema?tab=readme-ov-file#installing)
38-
3933
## Getting Started
34+
4035
Currently, there are no pre-built binaries available. To build from source, make sure the prerequisites are installed.
41-
Once you got these dependencies installed and this repository cloned, you can build the `nex` binary with the
36+
Once you got these dependencies installed and this repository cloned, you can build the `nex` binary with the
4237
following command:
38+
4339
```shell
4440
task nex
4541
```
4642

4743
With the nex binary built and a local nats server running, we can finally run our node:
44+
4845
```shell
4946
mkdir -p ~/.config/nex
5047
target/nex node up
5148
```
52-

Taskfile.yaml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
version: '3'
22

33
tasks:
4-
# requires the protoc binary in the path, and the `protoc-gen-go` plugin
5-
# 'go install google.golang.org/protobuf/cmd/protoc-gen-go@latest'
4+
install-godeps:
5+
cmds:
6+
- go install github.com/atombender/go-jsonschema@latest
7+
- go install google.golang.org/protobuf/cmd/[email protected]
8+
9+
install-protoc:
10+
cmds:
11+
- curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
12+
- sudo unzip protoc-28.3-linux-x86_64.zip -d /usr/local
13+
- rm protoc-28.3-linux-x86_64.zip
14+
15+
install-deps:
16+
deps: [install-godeps, install-protoc]
617

718
proto:
819
dir: node/internal/actors/pb
@@ -20,20 +31,17 @@ tasks:
2031
deps: [gen-schema-nodecontrol, gen-schema-agent]
2132

2233
gen-schema-agent:
23-
dir: api/agent/go
34+
dir: api/agent
2435
cmds:
25-
- "go-jsonschema \
26-
--schema-package=https://github.com/synadia-io/nex/api/agent/register-agent-request=github.com/synadia-io/nex/agentapi/go/gen \
27-
--schema-output=https://github.com/synadia-io/nex/api/agent/register-agent-request=gen/register_agent_request.go \
28-
../register-agent-request.json"
29-
- "go-jsonschema \
30-
--schema-package=https://github.com/synadia-io/nex/api/agent/start-workload-request=github.com/synadia-io/nex/api/agent/go/gen \
31-
--schema-output=https://github.com/synadia-io/nex/api/agent/start-workload-request=gen/start_workload_request.go \
32-
../start-workload-request.json"
33-
- "go-jsonschema \
34-
--schema-package=https://github.com/synadia-io/nex/api/agent/stop-workload-request=github.com/synadia-io/nex/agentapi/go/gen \
35-
--schema-output=https://github.com/synadia-io/nex/api/agent/stop-workload-request=gen/stop_workload_request.go \
36-
../stop-workload-request.json"
36+
- go-jsonschema
37+
--package=gen
38+
--schema-package=https://github.com/synadia-io/nex/api/agent/register-agent-request=github.com/synadia-io/nex/agentapi/go/gen
39+
--schema-output=https://github.com/synadia-io/nex/api/agent/register-agent-request=go/gen/register_agent_request.go
40+
--schema-package=https://github.com/synadia-io/nex/api/agent/start-workload-request=github.com/synadia-io/nex/api/agent/go/gen
41+
--schema-output=https://github.com/synadia-io/nex/api/agent/start-workload-request=go/gen/start_workload_request.go
42+
--schema-package=https://github.com/synadia-io/nex/api/agent/stop-workload-request=github.com/synadia-io/nex/agentapi/go/gen
43+
--schema-output=https://github.com/synadia-io/nex/api/agent/stop-workload-request=go/gen/stop_workload_request.go
44+
*.json
3745

3846
gen-schema-nodecontrol:
3947
dir: api/nodecontrol
@@ -73,7 +81,7 @@ tasks:
7381
*.json
7482

7583
nex:
76-
deps: [proto]
84+
deps: [all-code-gen]
7785
dir: cmd/nex
7886
cmds:
7987
- go build -o ../../target/nex .

0 commit comments

Comments
 (0)