-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from streamingfast/codegen-cmd
Codegen overhaul
- Loading branch information
Showing
346 changed files
with
7,633 additions
and
8,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
branches: | ||
- develop | ||
- feature/* | ||
- codegen-cmd | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Integration tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- codegen-cmd | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
if: "${{ !startsWith(github.event.head_commit.message, 'GitBook: [#') }}" | ||
|
||
env: | ||
TEST_LOCAL_CODEGEN: "true" | ||
RUN_INTEGRATION_TESTS: "true" | ||
CODEGEN_MAINNET_API_KEY: ${{ secrets.CODEGEN_MAINNET_API_KEY }} | ||
REGISTRY: ghcr.io | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ">=1.23.0" | ||
cache: true | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run Tests | ||
run: go test -v ./... | ||
|
||
- name: Build | ||
run: go build ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
.envrc | ||
/sink-data | ||
.idea | ||
*.log | ||
*.logmytest | ||
/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This template holds chunks of common .gitignore | ||
|
||
{{ define "gitignore_usage" -}} | ||
# substreams auth file | ||
.substreams.env | ||
|
||
# Compiled source files | ||
target/ | ||
|
||
# Sink data when running any sinker | ||
sink-data/ | ||
|
||
# The spkg packed by the subtreams cli | ||
*.spkg | ||
{{- end }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This template holds chunks of common README.md | ||
|
||
{{ define "readme_usage" -}} | ||
## Usage | ||
|
||
```bash | ||
substreams build | ||
substreams auth | ||
substreams gui | ||
``` | ||
{{- end }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package codegen | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"text/template" | ||
|
||
"github.com/bmatcuk/doublestar/v4" | ||
) | ||
|
||
//go:embed common-templates/*.gotmpl | ||
var commonTemplatesFS embed.FS | ||
|
||
var commonTemplates *template.Template | ||
|
||
func init() { | ||
var err error | ||
commonTemplates, err = parseCommonTemplates() | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
func parseCommonTemplates() (*template.Template, error) { | ||
t := template.New("").Funcs(templateFuncs) | ||
filenames, err := doublestar.Glob(commonTemplatesFS, "**/*.gotmpl") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, filename := range filenames { | ||
b, err := fs.ReadFile(commonTemplatesFS, filename) | ||
if err != nil { | ||
return nil, err | ||
} | ||
_, err = t.New(filename).Parse(string(b)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
return t, nil | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.