Skip to content

Commit

Permalink
Merge branch 'development' into releaseV0_6_0
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardmack committed Aug 11, 2021
2 parents 6bf1c62 + 0932ee8 commit 117a913
Show file tree
Hide file tree
Showing 315 changed files with 23,339 additions and 8,037 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# Primary repo maintainers
* @noot @arijitAD @edwardmack @timwu20
* @noot @arijitAD @edwardmack @timwu20 @EclesioMeloJunior @jimjbrettj
14 changes: 14 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ Changes that only affect a single file can be tested with
$ go test <file_you_are_working_on>
```

Sometimes you may need to create mocks for interfaces, in that case you will just execute:

```
$ make mock path=$(path to the interface) interface=$(interface name)
```

The command above will generate a file with prefix `mock_` inside the interface folder, if you want to generate the same mock but inside the `mocks` folder, you can execute:

```
$ make mock path=$(path to the interface) interface=$(interface name) INMOCKS=1
```

The command above will generate the mock inside the folder `$(path)/mocks`, and the mocks will be in the same package that your interface is.

**8. Lint your changes.**

Before opening a pull request be sure to run the linter
Expand Down
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ supported format for automatically closing issues (ie, closes #123, fixes #123)
-->

-

## Primary Reviewer

<!--
Please indicate one of the code owners that are required to review prior to merging changes (e.g. @noot)
-->

-
54 changes: 43 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,74 @@ jobs:
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2

# cache go build cache
- name: Cache go modules
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build

# cache go mod cache
- name: Cache go modules
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod

- name: Run build
run: make build

publish-code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2

# cache go build cache
- name: Cache go modules
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build

# cache go mod cache
- name: Cache go modules
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod

- name: Install Subkey
run: |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
chmod +x $HOME/.local/bin/subkey
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate coverage report
run: |
go test ./... -short -coverprofile=coverage.out -covermode=atomic -timeout=20m
- uses: codecov/codecov-action@v1
with:
token: "89982880-a53b-4a3a-9bdd-3dc9c78bd190"
files: ./coverage.out
flags: unit-tests
name: coverage
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
version: 'latest'
args: -v

vet-check:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- uses: actions/setup-go@v2
with:
go-version: '1.15.x'
- uses: actions/checkout@v2
Expand Down
102 changes: 87 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,50 @@ jobs:
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2

# cache go build cache
- name: Cache go modules
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build

# cache go mod cache
- name: Cache go modules
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod

- name: Install Subkey
run: |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
if [ "$RUNNER_OS" == "Linux" ]; then
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
elif [ "$RUNNER_OS" == "macOS" ]; then
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0-macos
mv $HOME/.local/bin/subkey-v2.0.0-macos $HOME/.local/bin/subkey
else
echo "Subkey for $RUNNER_OS is not supported"
exit 1
fi
chmod +x $HOME/.local/bin/subkey
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run unit tests
run: go test -short ./... -timeout=20m
run: go test -short ./... -timeout=30m

- name: Test State - Race
run: make test-state-race
Expand All @@ -42,23 +65,45 @@ jobs:
publish-code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2

# cache go build cache
- name: Cache go modules
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build

# cache go mod cache
- name: Cache go modules
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod

- name: Install Subkey
run: |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
chmod +x $HOME/.local/bin/subkey
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate coverage report
run: |
go test ./... -short -coverprofile=coverage.out -covermode=atomic -timeout=20m
- uses: codecov/codecov-action@v1
with:
with:
if_ci_failed: success
informational: true
files: ./coverage.out
flags: unit-tests
name: coverage
Expand Down Expand Up @@ -87,6 +132,7 @@ jobs:
name: Run stable tests
run: |
docker run chainsafe/gossamer:test sh -c "make it-stable"
docker-rpc-tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -110,6 +156,7 @@ jobs:
name: Run rpc tests
run: |
docker run chainsafe/gossamer:test sh -c "make it-rpc"
docker-stress-tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -133,6 +180,7 @@ jobs:
name: Run stress
run: |
docker run chainsafe/gossamer:test sh -c "make it-stress"
docker-grandpa-tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -153,6 +201,30 @@ jobs:
push: false
tags: chainsafe/gossamer:test
-
name: Run stress
name: Run grandpa
run: |
docker run chainsafe/gossamer:test sh -c "make it-grandpa"
docker-polkadotjs-tests:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build
id: docker_build
uses: docker/build-push-action@v2
with:
load: true
file: ./Dockerfile
platforms: linux/amd64
push: false
tags: chainsafe/gossamer:test
-
name: Run polkadotjs tests
run: |
docker run chainsafe/gossamer:test sh -c "make it-polkadotjs"
16 changes: 10 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ linters-settings:
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
golint:
revive:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
gofmt:
Expand Down Expand Up @@ -187,10 +187,10 @@ linters:
- govet
- gofmt
- goimports
- gosimple
- varcheck
- misspell
- ineffassign
- gosimple
- unconvert
- goconst
- errcheck
Expand All @@ -200,7 +200,7 @@ linters:
- gosec
- bodyclose
- goprintffuncname
- golint
- revive
- depguard
- gocyclo
- unparam
Expand Down Expand Up @@ -245,15 +245,19 @@ issues:
text: "SA9003:"

- linters:
- golint
- gosimple
text: "S1025:"

- linters:
- revive
text: "package comment should be of the form"

- linters:
- golint
- revive
text: "don't use ALL_CAPS in Go names;"

- linters:
- golint
- revive
text: "don't use underscores in Go names;"

- linters:
Expand Down
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ RUN apt-get update && \
apt-get install -y \
gcc \
cmake \
wget
wget \
curl \
npm

# Install node source for polkadotjs tests
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -

# Install nodejs for polkadotjs tests
RUN apt-get update && \
apt-get install -y \
nodejs

# Install Go
RUN wget https://dl.google.com/go/go1.15.5.linux-amd64.tar.gz
Expand Down Expand Up @@ -36,6 +46,9 @@ RUN go mod download
# Copy gossamer sources
COPY . $GOPATH/src/github.com/ChainSafe/gossamer

# Install js dependencies for polkadot.js tests
RUN cd $GOPATH/src/github.com/ChainSafe/gossamer/tests/polkadotjs_test && npm install

# Build
RUN GOBIN=$GOPATH/src/github.com/ChainSafe/gossamer/bin go run scripts/ci.go install

Expand All @@ -48,4 +61,4 @@ RUN chmod +x $GOPATH/src/github.com/ChainSafe/gossamer/scripts/docker-entrypoint
# Expose gossamer command and port
ENTRYPOINT ["/gocode/src/github.com/ChainSafe/gossamer/scripts/docker-entrypoint.sh"]
CMD ["/usr/local/gossamer"]
EXPOSE 7001
EXPOSE 7001 8546 8540
Loading

0 comments on commit 117a913

Please sign in to comment.