Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Add Rosetta API
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed Sep 22, 2021
1 parent 2797842 commit 6de9f52
Show file tree
Hide file tree
Showing 189 changed files with 16,698 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Goal of this PR

Fixes #

## Checklist

- [ ] Is on the right branch
- [ ] Documentation is up-to-date
- [ ] Tests are up-to-date
107 changes: 107 additions & 0 deletions .github/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI

# Continuous integration will run whenever a pull request for the master branch
# is created or updated.
on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Check out source code
uses: actions/checkout@v2

- name: Check out FlowGo
uses: actions/checkout@v2
with:
repository: onflow/flow-go
ref: c0afa789365eb7a22713ed76b8de1e3efaf3a70a
path: flow-go

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

# The protobuf steps uses the official instructions to install the
# pre-compiled binary, see:
# https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os
- name: Install Protobuf compiler
run: |
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip
unzip protoc-3.17.3-linux-x86_64.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
git clean -fd
# In order to be able to generate the protocol buffer and GRPC files, we
# need to install the related Go modules.
- name: Install Protobuf dependencies
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/srikrsna/[email protected]
# Since building relic takes some time, we want to cache it.
- name: Cache Crypto package
uses: actions/cache@v2
with:
path: ./flow-go/crypto
key: ${{ runner.os }}-crypto
restore-keys: |
${{ runner.os }}-crypto
# In order to be able to build with flow-go and the relic tag, we need to
# run its go generate target.
- name: Install Flow Go's crypto
run: |
cd ./flow-go/crypto
go generate .
# This check makes sure that the `go.mod` and `go.sum` files for Go
# modules are always up-to-date.
- name: Verify Go modules
run: go mod tidy && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the generated protocol buffer files in Go
# have been updated in case there was a change in the definitions.
- name: Verify generated files
run: go generate ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the source code is formatted according to the
# Go standard `go fmt` formatting.
- name: Verify source code formatting
run: go fmt ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that we can compile the binary as a pure Go binary
# without CGO support.
- name: Verify compilation
run: go build -tags relic ./...

# This check runs all unit tests with verbose output and ensures that all
# of the tests pass successfully.
- name: Verify unit tests
run: go test -tags relic -v ./...

# This check runs all integration tests with verbose output and ensures
# that they pass successfully.
- name: Verify integration tests
run: go test -v -tags="relic integration" ./...
97 changes: 97 additions & 0 deletions .github/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: AutoRelease

# AutoRelease will run whenever a tag is pushed.
on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Check out FlowGo
uses: actions/checkout@v2
with:
repository: onflow/flow-go
ref: c0afa789365eb7a22713ed76b8de1e3efaf3a70a
path: flow-go

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

# The protobuf steps uses the official instructions to install the
# pre-compiled binary, see:
# https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os
- name: Install Protobuf compiler
run: |
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip
unzip protoc-3.17.3-linux-x86_64.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
git clean -fd
# In order to be able to generate the protocol buffer and GRPC files, we
# need to install the related Go modules.
- name: Install Protobuf dependencies
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/srikrsna/[email protected]
# In order to be able to build with flow-go and the relic tag, we need to
# run its go generate target.
- name: Install Flow Go's crypto
run: |
cd ./flow-go/crypto
go generate .
# This check makes sure that the `go.mod` and `go.sum` files for Go
# modules are always up-to-date.
- name: Verify Go modules
run: go mod tidy && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the generated protocol buffer files in Go
# have been updated in case there was a change in the definitions.
- name: Generate files
run: go generate ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# Install GoReleaser and print its version before running.
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true

- name: Show GoReleaser version
run: goreleaser -v

# Run GoReleaser.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Goal of this PR

Fixes #

## Checklist

- [ ] Is on the right branch
- [ ] Documentation is up-to-date
- [ ] Tests are up-to-date
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

# Continuous integration will run whenever a pull request for the master branch
# is created or updated.
on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Check out source code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

# This check makes sure that the `go.mod` and `go.sum` files for Go
# modules are always up-to-date.
- name: Verify Go modules
run: go mod tidy && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the generated protocol buffer files in Go
# have been updated in case there was a change in the definitions.
- name: Verify generated files
run: go generate ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the source code is formatted according to the
# Go standard `go fmt` formatting.
- name: Verify source code formatting
run: go fmt ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that we can compile the binary as a pure Go binary
# without CGO support.
- name: Verify compilation
run: go build -tags relic ./...

# This check runs all unit tests with verbose output and ensures that all
# of the tests pass successfully.
- name: Verify unit tests
run: go test -tags relic -v ./...

# This check runs all integration tests with verbose output and ensures
# that they pass successfully.
- name: Verify integration tests
run: go test -v -tags="relic integration" ./...
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: AutoRelease

# AutoRelease will run whenever a tag is pushed.
on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

# This check makes sure that the `go.mod` and `go.sum` files for Go
# modules are always up-to-date.
- name: Verify Go modules
run: go mod tidy && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the generated protocol buffer files in Go
# have been updated in case there was a change in the definitions.
- name: Generate files
run: go generate ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

# Install GoReleaser and print its version before running.
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true

- name: Show GoReleaser version
run: goreleaser -v

# Run GoReleaser.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/cmd/flow-rosetta-server/flow-rosetta-server
*.cdc
*.checkpoint
*.log
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# By default, builds only for darwin and linux, which works for us since FlowGo does not support
# Windows builds. We also can only build on amd64 architectures since all others are also not
# supported at the moment.
builds:
- id: rosetta-server
binary: rosetta-server
main: ./cmd/flow-rosetta-server
goos:
- linux
goarch:
- amd64
flags:
- -tags=relic

archives:
- replacements:
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
Empty file modified README.md
100644 → 100755
Empty file.
Loading

0 comments on commit 6de9f52

Please sign in to comment.