Skip to content

feat: repo-template v1 #2

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

Merged
merged 4 commits into from
May 22, 2025
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
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5

- name: Install Gno
run: make install_deps

- name: Run tests
run: make test

- name: Run linter
run: make lint
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: all test lint fmt install_deps

all: fmt test lint

# Run the development node
dev:
gnodev

# Run all tests
test:
gno test -v ./...

# Run linter
lint:
gno lint -v .

# Format the code
fmt:
gno fmt -w ./...

install_deps:
curl https://raw.githubusercontent.com/gnolang/gno/refs/heads/master/misc/install.sh | bash

63 changes: 62 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,62 @@
WIP, see https://github.com/gnolang/repo-template/issues/1
# Gno Project Template

This repository serves as a template for starting Gno projects with best
practices and proper tooling baked in. It helps contributors or teams quickly
scaffold a real-world Gno setup.

## Features

- Handles installing Go & Gno dependencies
- Runs gnodev with a minimal default realm
- Includes test and lint commangids
- Integrated with GitHub Actions CI workflow
- Supports both p/ and r/ structure
- Configured for external dependencies
- Editor configurations included

## Prerequisites

- Go 1.21 or later
- Gno development environment

## Getting Started

1. Clone this repository:
```bash
git clone https://github.com/gnolang/repo-template.git
cd repo-template
```

2. Install dependencies:
```bash
make deps
```

3. Run tests:
```bash
make test
```

4. Start the development node:
```bash
make dev
```

## Project Structure

- `p/` - Contains packages that can be imported by other Gno code
- `r/` - Contains realms (smart contracts)
- `.github/workflows/` - CI/CD configuration
- `Makefile` - Common development commands

## Development

- `make test` - Run all tests
- `make lint` - Run linter
- `make clean` - Clean build artifacts
- `make deps` - Install dependencies
- `make dev` - Run development node

## License

MIT
6 changes: 6 additions & 0 deletions p/example/example.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package example

// Add adds two integers and returns their sum
func Add(a, b int) int {
return a + b
}
1 change: 1 addition & 0 deletions p/example/gno.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module gno.land/p/username/example
1 change: 1 addition & 0 deletions r/example/gno.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module gno.land/r/username/example
11 changes: 11 additions & 0 deletions r/example/main.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package example

// This function is called when the realm is deployed.
func init() {
// ...
}

// This function is called when the realm is rendered through gnoweb.
func Render(path string) string {
return "Hello, Gno!"
}
Loading