Skip to content
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

chore: fix CI not testing the examples/ folder #784

Merged
merged 2 commits into from
Apr 27, 2023
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
16 changes: 15 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,18 @@ jobs:
- run: go install -v ./gnovm/cmd/gno
- run: go run ./gnovm/cmd/gno precompile --verbose ./examples
- run: go run ./gnovm/cmd/gno build --verbose ./examples
# unittests: TODO: matrix with contracts
test:
strategy:
fail-fast: false
matrix:
go-version: [ "1.19.x", "1.20.x" ]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: go install -v ./gnovm/cmd/gno
- run: go run ./gnovm/cmd/gno test --verbose ./examples
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions examples/gno.land/r/demo/releases_example/releases1_filetest.gno
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"gno.land/r/demo/releases-example"
"gno.land/r/demo/releases_example"
)

func main() {
Expand All @@ -17,18 +17,18 @@ func main() {

// Output:
// -----------
// # example-app
// # example_app
//
// ## [example-app v2 (latest)](r/demo/examples-example-v2)
// ## [example_app v2 (latest)](r/demo/examples_example_v2)
//
// various improvements
//
// ## [example-app v1](r/demo/examples-example-v1)
// ## [example_app v1](r/demo/examples_example_v1)
//
// initial release
//
// -----------
// ## [example-app v1](r/demo/examples-example-v1)
// ## [example_app v1](r/demo/examples_example_v1)
//
// initial release
//
Expand Down
9 changes: 8 additions & 1 deletion gnovm/tests/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,19 @@ func testPackageInjector(store gno.Store, pn *gno.PackageNode) {
// Also inject stdlibs native functions.
stdlibs.InjectPackage(store, pn)
isOriginCall := func(m *gno.Machine) bool {
switch m.Frames[0].Func.Name {
tname := m.Frames[0].Func.Name
switch tname {
case "main": // test is a _filetest
return len(m.Frames) == 3
case "runtest": // test is a _test
return len(m.Frames) == 7
}
// support init() in _filetest
// XXX do we need to distinguish from 'runtest'/_test?
// XXX pretty hacky even if not.
if strings.HasPrefix(string(tname), "init.") {
return len(m.Frames) == 3
}
moul marked this conversation as resolved.
Show resolved Hide resolved
panic("unable to determine if test is a _test or a _filetest")
}
// Test specific injections:
Expand Down