Skip to content

Commit

Permalink
Merge branch 'master' into hof
Browse files Browse the repository at this point in the history
  • Loading branch information
leohhhn authored Sep 30, 2024
2 parents 9a171ff + 01d9e8d commit e2dcbca
Show file tree
Hide file tree
Showing 26 changed files with 837 additions and 104 deletions.
34 changes: 0 additions & 34 deletions .benchmarks/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions .benchmarks/gobenchdata-checks.yml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ builds:
goarm:
- 6
- 7
- id: gnobro
dir: ./contribs/gnodev/cmd/gnobro
binary: gnobro
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
- arm
goarm:
- 6
- 7

gomod:
proxy: true
Expand Down Expand Up @@ -489,6 +504,74 @@ dockers:
ids:
- gnofaucet

# gnobro
- use: buildx
dockerfile: Dockerfile.release
goos: linux
goarch: amd64
image_templates:
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-amd64"
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-amd64"
build_flag_templates:
- "--target=gnobro"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnobro"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
ids:
- gnobro
- use: buildx
dockerfile: Dockerfile.release
goos: linux
goarch: arm64
image_templates:
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-arm64v8"
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-arm64v8"
build_flag_templates:
- "--target=gnobro"
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnobro"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
ids:
- gnobro
- use: buildx
dockerfile: Dockerfile.release
goos: linux
goarch: arm
goarm: 6
image_templates:
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-armv6"
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-armv6"
build_flag_templates:
- "--target=gnobro"
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnobro"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
ids:
- gnobro
- use: buildx
dockerfile: Dockerfile.release
goos: linux
goarch: arm
goarm: 7
image_templates:
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-armv7"
- "ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-armv7"
build_flag_templates:
- "--target=gnobro"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}/gnobro"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
ids:
- gnobro

docker_manifests:
# https://goreleaser.com/customization/docker_manifest/

Expand Down Expand Up @@ -562,6 +645,20 @@ docker_manifests:
- ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv6
- ghcr.io/gnolang/{{ .ProjectName }}/gnofaucet:{{ .Env.TAG_VERSION }}-armv7

# gnobro
- name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}
image_templates:
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-amd64
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-arm64v8
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-armv6
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Version }}-armv7
- name_template: ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}
image_templates:
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-amd64
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-arm64v8
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-armv6
- ghcr.io/gnolang/{{ .ProjectName }}/gnobro:{{ .Env.TAG_VERSION }}-armv7

docker_signs:
- cmd: cosign
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/benchmark-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ jobs:
secrets: inherit
with:
publish: false
test-flags: "-short"
test-flags: "-short"
external-data-json-path: "./cache/benchmark-data.json"
4 changes: 3 additions & 1 deletion .github/workflows/benchmark-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # run on default branch every day

jobs:
publish:
uses: ./.github/workflows/benchmark_template.yml
secrets: inherit
with:
publish: true
test-flags: "-timeout 50m"
test-flags: "-timeout 50m"
runner-additional-tag: "benchmarks-large"
60 changes: 48 additions & 12 deletions .github/workflows/benchmark_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,65 @@ on:
test-flags:
required: true
type: string
runner-additional-tag:
type: string
default: benchmarks
external-data-json-path:
type: string

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

env:
CGO_ENABLED: 0

jobs:
benchmarks:
if: ${{ github.repository == 'gnolang/gno' }}
runs-on: [self-hosted, Linux, X64, benchmark-v1]
runs-on: [self-hosted, Linux, X64, "${{ inputs.runner-additional-tag }}"]
steps:
- name: checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- name: "gobenchdata publish: ${{ inputs.publish }}"
run: go run go.bobheadxi.dev/gobenchdata@v1 action
env:
INPUT_PRUNE_COUNT: 30
INPUT_GO_TEST_FLAGS: "${{ inputs.test-flags }} -run=^$ -cpu 1,2" # executing only using one and two CPUs to not be dependant on the machine cores.
INPUT_PUBLISH: ${{ inputs.publish }}
INPUT_PUBLISH_BRANCH: gh-benchmarks
INPUT_BENCHMARKS_OUT: benchmarks.json
INPUT_CHECKS: ${{ !inputs.publish }}
INPUT_CHECKS_CONFIG: .benchmarks/gobenchdata-checks.yml

- name: Run benchmark
run: |
go test -benchmem -bench=. ./... -run=^$ \
-cpu 1,2 ${{ inputs.test-flags }} | tee benchmarks.txt
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store benchmark results into `gh-benchmarks` branch
uses: benchmark-action/github-action-benchmark@v1
# see https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#action-inputs
with:
name: Go Benchmarks
tool: 'go'
output-file-path: benchmarks.txt
# Where the previous data file is stored
external-data-json-path: ${{ inputs.external-data-json-path }}
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '20%'
fail-on-alert: true
comment-on-alert: true
# Enable Job Summary for PRs
summary-always: true
github-token: ${{ secrets.GITHUB_TOKEN }}
# NOTE you need to use a separate GITHUB PAT token that has a write access to the specified repository.
# gh-repository: 'github.com/gnolang/benchmarks' # on gh-pages branch
gh-pages-branch: gh-benchmarks
benchmark-data-dir-path: .
auto-push: ${{ inputs.publish }}
alert-comment-cc-users: '@ajnavarro,@thehowl,@zivkovicmilos'
10 changes: 8 additions & 2 deletions Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ EXPOSE 26656 26657

ENTRYPOINT [ "/usr/bin/gnoland" ]


#
## ghcr.io/gnolang/gno/gnokey
FROM base as gnokey

COPY ./gnokey /usr/bin/gnokey
ENTRYPOINT [ "/usr/bin/gnokey" ]


#
## ghcr.io/gnolang/gno/gnoweb
FROM base as gnoweb
Expand All @@ -43,6 +41,14 @@ COPY ./gnofaucet /usr/bin/gnofaucet
EXPOSE 5050
ENTRYPOINT [ "/usr/bin/gnofaucet" ]

#
## ghcr.io/gnolang/gno/gnobro
FROM base as gnobro

COPY ./gnobro /usr/bin/gnobro
EXPOSE 22
ENTRYPOINT [ "/usr/bin/gnobro" ]

#
## ghcr.io/gnolang/gno
FROM base as gno
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/users/gno.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module gno.land/r/demo/users
require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/avlhelpers v0.0.0-latest
gno.land/p/demo/uassert v0.0.0-latest
gno.land/p/demo/users v0.0.0-latest
)
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/users/preregister.gno
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var preRegisteredUsers = []struct {
{"nt", "g15ge0ae9077eh40erwrn2eq0xw6wupwqthpv34l"}, // -> @r_nt
{"sys", "g1r929wt2qplfawe4lvqv9zuwfdcz4vxdun7qh8l"}, // -> @r_sys
{"x", "g164sdpew3c2t3rvxj3kmfv7c7ujlvcw2punzzuz"}, // -> @r_x

// test1 user
{"test1", "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"}, // -> @test1
}

func init() {
Expand Down
13 changes: 13 additions & 0 deletions examples/gno.land/r/demo/users/users_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package users

import (
"testing"

"gno.land/p/demo/uassert"
)

func TestPreRegisteredTest1(t *testing.T) {
names := ListUsersByPrefix("test1", 1)
uassert.Equal(t, len(names), 1)
uassert.Equal(t, names[0], "test1")
}
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/users/z_5_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func main() {
// * [nt](/r/demo/users:nt)
// * [satoshi](/r/demo/users:satoshi)
// * [sys](/r/demo/users:sys)
// * [test1](/r/demo/users:test1)
// * [x](/r/demo/users:x)
//
// ========================================
Expand Down
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoland/testdata/restart_missing_type.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ gnoland restart
}
],
"fee": {
"gas_wanted": "15000000",
"gas_wanted": "16000000",
"gas_fee": "1000000ugnot"
},
"signatures": [],
Expand Down
2 changes: 1 addition & 1 deletion gno.land/pkg/gnoweb/views/funcs.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<meta property="og:description" content="{{ .Data.Description }}" />
<noscript>
<style type="text/css">
#source { display: block; }
#source { opacity: 1; }
#theme-toggle { display: none; }
</style>
</noscript>
Expand Down
9 changes: 7 additions & 2 deletions gnovm/cmd/gno/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/gnovm/tests"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/std"
)

type runCfg struct {
Expand Down Expand Up @@ -112,11 +113,15 @@ func execRun(cfg *runCfg, args []string, io commands.IO) error {
return errors.New("no files to run")
}

var send std.Coins
pkgPath := string(files[0].PkgName)
ctx := tests.TestContext(pkgPath, send)
m := gno.NewMachineWithOptions(gno.MachineOptions{
PkgPath: string(files[0].PkgName),
Input: stdin,
PkgPath: pkgPath,
Output: stdout,
Input: stdin,
Store: testStore,
Context: ctx,
Debug: cfg.debug || cfg.debugAddr != "",
})

Expand Down
4 changes: 4 additions & 0 deletions gnovm/cmd/gno/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func TestRunApp(t *testing.T) {
args: []string{"run", "../../tests/integ/invalid_assign/main.gno"},
recoverShouldContain: "cannot use bool as main.C without explicit conversion",
},
{
args: []string{"run", "-expr", "Context()", "../../tests/integ/context/context.gno"},
stdoutShouldContain: "Context worked",
},
// TODO: a test file
// TODO: args
// TODO: nativeLibs VS stdlibs
Expand Down
Loading

0 comments on commit e2dcbca

Please sign in to comment.