Skip to content

Commit

Permalink
Go Setup (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: Trajan0x <[email protected]>
  • Loading branch information
trajan0x and trajan0x authored May 25, 2022
1 parent d810a1a commit 13679cf
Show file tree
Hide file tree
Showing 64 changed files with 31,786 additions and 7,527 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Treat all Go files in this repo as binary, with no git magic updating
# line endings. Windows users contributing to Go will need to use a
# modern version of git and editors capable of LF line endings.

*.go -text diff=golang

# don't count abigen files in linguist as go
*.abigen.go linguist-vendored
# ignore multicopier files
*_gen.go linguist-vendored

# svg should be treated as a binary https://git.io/JE2VK
*.svg binary
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ M-contracts:

C-Protocol-Critical:
- 'packages/contracts/**/*.sol'

Go:
- '**/*.go'
23 changes: 23 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": [
"config:base"
],
"assignees": [],
"enabledManagers": ["gomod"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"excludePackagePrefixes": [],
"matchManagers": ["gomod"],
"automerge": true,
"postUpdateOptions": [
"gomodTidy"
]
}
],
"branchConcurrentLimit": 10,
"prConcurrentLimit": 10,
"git-submodules": {
"enabled": true
}
}
13 changes: 13 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: false
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
129 changes: 129 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Go Workflows
on:
pull_request:
push:
branches-ignore:
- 'gh-pages'


jobs:
# make sure the build works
build:
name: Build
runs-on: ${{ matrix.platform }}
strategy:
matrix:
go-version:
- 1.18.x
platform:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: authenticate with github for private go modules
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: https://0xnero:${{secrets.GIT_TOKEN }}@github.com/
- name: Go modules cache
uses: actions/cache@v2
with:
# see https://github.com/mvdan/github-actions-golang
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
# go build all workspaces
run: go build $(go work edit -json | jq -c -r '[.Use[].DiskPath] | map_values(. + "/...")[]')

test:
name: Test
runs-on: ${{ matrix.platform }}
strategy:
matrix:
go-version:
- 1.18.x
platform:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: Go modules cache
uses: actions/cache@v2
with:
# see https://github.com/mvdan/github-actions-golang
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: authenticate with github for private go modules
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: https://trajan0x:${{secrets.GIT_TOKEN }}@github.com/

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Test
run: go test $(go work edit -json | jq -c -r '[.Use[].DiskPath] | map_values(. + "/...")[]') -coverprofile=profile.cov

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
github-token: ${{ secrets.github_token }}
path-to-profile: profile.cov

#note: right now this is not run against all work dirs
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18

- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'

- name: authenticate with github for private go modules
uses: fusion-engineering/setup-git-credentials@v2
with:
credentials: https://0xnero:${{secrets.GIT_TOKEN }}@github.com/

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
working-directory: core/
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.46.2
# Path to your GolangCI-Lint config within the repo (optional)
config: .golangci.yml
# see: https://github.com/golangci/golangci-lint/issues/2654
env:
# GitHub token for annotations (optional)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# see: https://github.com/golangci/golangci-lint/issues/337#issuecomment-510136513
GOGC: 20
GOPRIVATE: "GOPRIVATE=github.com/synapsecns/synapse-node"
72 changes: 71 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,75 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

## See Go gitignore: https://github.com/github/gitignore/blob/master/Go.gitignore
##

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

## See terraform gitignore:
## https://github.com/github/gitignore/blob/master/Terraform.gitignore

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc
# the terraform config creates a `kubeconfig` file, we want to prevent users from accidentally committing this
**/kubeconfig*

# for local goreleaser builds
dist/
config.toml

# ignore intellij .idea folder
.idea
limit.csv

vendor/

.DS_Store
Expand Down Expand Up @@ -41,5 +110,6 @@ coverage.out
.idea/

.gas-snapshot
profile.cov


types
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# sanguine
Implementation of the Sanguine messaging standard
# Sanguine

[![Go Workflows](https://github.com/synapsecns/sanguine/actions/workflows/go.yml/badge.svg)](https://github.com/synapsecns/sanguine/actions/workflows/go.yml)
[![Foundry Tests](https://github.com/synapsecns/sanguine/actions/workflows/foundry-tests.yml/badge.svg)](https://github.com/synapsecns/sanguine/actions/workflows/foundry-tests.yml)


## Contributing

Read through [CONTRIBUTING.md](./CONTRIBUTING.md) for a general overview of our contribution process.
Then check out our list of [good first issues](https://github.com/ethereum-optimism/optimism/contribute) to find something fun to work on!

## Directory Structure

<pre>
root
├── <a href="./packages">packages</a>
│ ├── <a href="./packages/contracts">contracts</a>: Contracts used for synapse

├── <a href="./core">core</a>: Core service contains the code used by different agents
</pre>


## Setup

Clone the repository, open it, and install nodejs packages with `yarn`:

```bash
git clone https://github.com/synapsecns/sanguine
cd sanguine
yarn install
```


### Install the Correct Version of NodeJS

Using `nvm`, install the correct version of NodeJS.

```
nvm use
```

### Building the TypeScript packages

To build all of the [TypeScript packages](./packages), run:

```bash
yarn clean
yarn build
```

Packages compiled when on one branch may not be compatible with packages on a different branch.
**You should recompile all packages whenever you move from one branch to another.**
Use the above commands to recompile the packages.
Loading

0 comments on commit 13679cf

Please sign in to comment.