Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gnolang/gno
Browse files Browse the repository at this point in the history
  • Loading branch information
deelawn committed Apr 22, 2024
2 parents 23f13fb + 90f29c4 commit 54025db
Show file tree
Hide file tree
Showing 135 changed files with 1,587 additions and 678 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

# Gno examples and default contracts.
/examples/ @gnolang/tech-staff @gnolang/devrels
/examples/gno.land/p/demo/ @gnolang/tech-staff @gnolang/devrels
/examples/gno.land/r/demo/ @gnolang/tech-staff @gnolang/devrels
/examples/gno.land/r/gnoland/ @moul
/examples/gno.land/p/gov/ @moul
/examples/gno.land/p/sys/ @moul
/examples/gno.land/r/gov/ @moul
/examples/gno.land/r/sys/ @moul
/examples/gno.land/r/worx/ @moul
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master", "chain/*" ]
pull_request:
branches: [ "master", "chain/*" ]
schedule:
- cron: '22 17 * * 3'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
3 changes: 2 additions & 1 deletion .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
strategy:
fail-fast: false
matrix:
goversion: # two latest versions
goversion:
- "1.22.x"
program:
- "gnomd"
- "gnodev"
- "gnofaucet"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ jobs:
- run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/p
- run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/r/demo
- run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/r/gnoland
- run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/r/system
- run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/r/sys
# - run: go run ./gnovm/cmd/gno lint -v ./examples/gno.land/r/gov
# TODO: consider running lint on every other directories, maybe in "warning" mode?
# TODO: track coverage
mod-tidy:
strategy:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
- gnoland
- gnokey
- gnoweb
- gnofaucet
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
36 changes: 23 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
# build
FROM golang:1.22 AS build
# build gno
FROM golang:1.22 AS build-gno
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD go.mod go.sum ./
ADD go.mod go.sum .
RUN go mod download
ADD . ./
RUN go build -o ./build/gnoland ./gno.land/cmd/gnoland
RUN go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN go build -o ./build/gnofaucet ./gno.land/cmd/gnofaucet
RUN go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN go build -o ./build/gno ./gnovm/cmd/gno
RUN ls -la ./build
ADD . /opt/gno/src/
RUN rm -rf /opt/gno/src/.git

# build faucet
FROM golang:1.22 AS build-faucet
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD contribs/gnofaucet/go.mod contribs/gnofaucet/go.sum .
RUN go mod download
ADD contribs/gnofaucet ./
RUN go build -o ./build/gnofaucet .


# runtime-base + runtime-tls
FROM debian:stable-slim AS runtime-base
ENV PATH="${PATH}:/opt/gno/bin" \
Expand All @@ -25,32 +34,33 @@ RUN apt-get update && apt-get install -y expect ca-certificates && updat
# slim images
FROM runtime-base AS gnoland-slim
WORKDIR /opt/gno/src/gno.land/
COPY --from=build /opt/build/build/gnoland /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gnoland /opt/gno/bin/
ENTRYPOINT ["gnoland"]
EXPOSE 26657 36657

FROM runtime-base AS gnokey-slim
COPY --from=build /opt/build/build/gnokey /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gnokey /opt/gno/bin/
ENTRYPOINT ["gnokey"]

FROM runtime-base AS gno-slim
COPY --from=build /opt/build/build/gno /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gno /opt/gno/bin/
ENTRYPOINT ["gno"]

FROM runtime-tls AS gnofaucet-slim
COPY --from=build /opt/build/build/gnofaucet /opt/gno/bin/
COPY --from=build-faucet /opt/build/build/gnofaucet /opt/gno/bin/
ENTRYPOINT ["gnofaucet"]
EXPOSE 5050

FROM runtime-tls AS gnoweb-slim
COPY --from=build /opt/build/build/gnoweb /opt/gno/bin/
COPY --from=build /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnoweb
COPY --from=build-gno /opt/build/build/gnoweb /opt/gno/bin/
COPY --from=build-gno /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnoweb
ENTRYPOINT ["gnoweb"]
EXPOSE 8888

# all, contains everything.
FROM runtime-tls AS all
COPY --from=build /opt/build/build/* /opt/gno/bin/
COPY --from=build /opt/gno/src /opt/gno/src
COPY --from=build-gno /opt/build/build/* /opt/gno/bin/
COPY --from=build-faucet /opt/build/build/* /opt/gno/bin/
COPY --from=build-gno /opt/gno/src /opt/gno/src
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build /usr/local/go/bin/gofmt /usr/bin
COPY --from=build-gno /usr/local/go/bin/gofmt /usr/bin
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,22 @@ VERIFY_MOD_SUMS ?= false
########################################
# Dev tools
.PHONY: install
install: install.gnokey install.gno
@if ! command -v gnodev > /dev/null; then \
echo ------------------------------; \
echo "For local realm development, gnodev is recommended: https://docs.gno.land/gno-tooling/cli/gno-tooling-gnodev"; \
echo "You can install it by calling 'make install.gnodev'"; \
fi
install: install.gnokey install.gno install.gnodev

# shortcuts to frequently used commands from sub-components.
.PHONY: install.gnokey
install.gnokey:
$(MAKE) --no-print-directory -C ./gno.land install.gnokey
@echo "[+] 'gnokey' is installed. more info in ./gno.land/."
# \033[0;32m ... \033[0m is ansi for green text.
@echo "\033[0;32m[+] 'gnokey' has been installed. Read more in ./gno.land/\033[0m"
.PHONY: install.gno
install.gno:
$(MAKE) --no-print-directory -C ./gnovm install
@echo "[+] 'gno' is installed. more info in ./gnovm/."
@echo "\033[0;32m[+] 'gno' has been installed. Read more in ./gnovm/\033[0m"
.PHONY: install.gnodev
install.gnodev:
$(MAKE) --no-print-directory -C ./contribs install.gnodev
@echo "[+] 'gnodev' is installed."
@echo "\033[0;32m[+] 'gnodev' has been installed. Read more in ./contribs/gnodev/\033[0m"

# old aliases
.PHONY: install_gnokey
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ repository offers more resources to dig into. We are eager to see your first PR!
* [gno](./gnovm/cmd/gno) - handy tool for developing gno packages & realms
* [goscan](./misc/goscan) - dumps imports from specified file’s AST
* [genproto](./misc/genproto) - helper for generating .proto implementations
* [gnofaucet](./gno.land/cmd/gnofaucet) - serves GNOT faucet
* [gnofaucet](./contribs/gnofaucet) - serves GNOT faucet
</details>

<details><summary>CI/CD/Tools badges and links</summary>
Expand Down
3 changes: 2 additions & 1 deletion contribs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ GOTEST_FLAGS ?= -v -p 1 -timeout=30m
########################################
# Dev tools
.PHONY: install
install: install.gnomd install.gnodev
install: install.gnomd install.gnodev install.gnofaucet

install.gnomd:; cd gnomd && go install .
install.gnodev:; $(MAKE) -C ./gnodev install
install.gnofaucet:; $(MAKE) -C ./gnofaucet install

.PHONY: clean
clean:
Expand Down
1 change: 0 additions & 1 deletion contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ require (
github.com/gorilla/sessions v1.2.1 // indirect
github.com/gotuna/gotuna v0.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/jaekwon/testify v1.6.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
Expand Down
3 changes: 0 additions & 3 deletions contribs/gnodev/go.sum

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

7 changes: 7 additions & 0 deletions contribs/gnofaucet/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: install
install:
go install .

.PHONY: build
build:
go build -o build/gnofaucet .
52 changes: 52 additions & 0 deletions contribs/gnofaucet/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module github.com/gnolang/gno/contribs/gnofaucet

go 1.21

require (
github.com/gnolang/faucet v0.2.0
github.com/gnolang/gno v0.0.0-20240418134550-6f54d2b3d06c
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
golang.org/x/time v0.5.0
)

require (
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/go-chi/chi/v5 v5.0.12 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/jaekwon/testify v1.6.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/peterbourgon/ff/v3 v3.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.10.1 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap/exp v0.2.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 54025db

Please sign in to comment.