Skip to content

Commit

Permalink
feat(go): upgrade Go from 1.17 to 1.18 (#2379)
Browse files Browse the repository at this point in the history
* Upgrade from Go 1.17 to Go 1.18

* Add `go mod download` to mocks workflow

* Run `go fix ./...`
  • Loading branch information
qdm12 committed Mar 22, 2022
1 parent 7cd4118 commit d85a1db
Show file tree
Hide file tree
Showing 42 changed files with 89 additions and 80 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
go-version: [1.17.x]
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -37,7 +36,10 @@ jobs:
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3

# cache go build cache
Expand All @@ -61,9 +63,6 @@ jobs:

publish-code-coverage:
timeout-minutes: 60
strategy:
matrix:
go-version: [1.17.x]
runs-on: ubuntu-latest
steps:
- id: go-cache-paths
Expand All @@ -72,7 +71,10 @@ jobs:
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3

# cache go build cache
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "1.17.x"
go-version: 1.18
stable: true
check-latest: true

- name: Lint
run: make lint
Expand All @@ -36,7 +38,10 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17.x"
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3
- name: Checks PR has title and body description
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/code-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ env:
jobs:
publish-code-coverage:
timeout-minutes: 60
strategy:
matrix:
go-version: [1.17.x]
runs-on: ubuntu-latest
steps:
- id: go-cache-paths
Expand All @@ -33,7 +30,10 @@ jobs:
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3

# cache go build cache
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "^1.17"
go-version: 1.18
stable: true
check-latest: true

- run: go install github.com/google/addlicense@v1.0.0

Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ on:
push:
branches:
- devnet

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v2
with:
go-version: '^1.17.0'
go-version: 1.18
stable: true
check-latest: true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down Expand Up @@ -65,7 +68,7 @@ jobs:
docker build --progress=plain \
-t=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t=$ECR_REGISTRY/$ECR_REPOSITORY:latest \
--build-arg key=charlie --build-arg DD_API_KEY=$DD_API_KEY --build-arg METRICS_NAMESPACE=gossamer.ecs.devnet \
-f=devnet/bob.Dockerfile .
-f=devnet/bob.Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
Expand All @@ -74,12 +77,12 @@ jobs:
working-directory: ./devnet/cmd/scale-down-ecs-service
run: |
go run . -c gssmr-ecs -s="gssmr-ecs-(Charlie|Bob)Service-.+$"
- name: docker compose up
id: docker-compose-up
working-directory: ./devnet/gssmr-ecs
run: |
curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh
docker context create ecs gssmr-ecs --from-env
docker context use gssmr-ecs
docker compose up
docker compose up
5 changes: 4 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3

# cache go build cache
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/mocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "^1.17"
go-version: 1.18
stable: true
check-latest: true

- run: go install github.com/vektra/mockery/v2@v2.10.0

Expand All @@ -26,13 +28,15 @@ jobs:
- name: Check devnet module
run: |
cd devnet && \
go mod download && \
go generate -run "mockery" -tags integration ./... && \
go generate -run "mockgen" -tags integration ./... && \
git diff --exit-code && \
cd ..
- name: Check Gossamer module
run: |
go mod download && \
go generate -run "mockery" -tags integration ./... && \
go generate -run "mockgen" -tags integration ./... && \
git diff --exit-code
11 changes: 5 additions & 6 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ env:
jobs:
unit-tests:
timeout-minutes: 60
strategy:
matrix:
go-version: [1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
runs-on: ubuntu-latest
steps:
- id: go-cache-paths
run: |
Expand All @@ -35,7 +31,10 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
go-version: 1.18
stable: true
check-latest: true

- uses: actions/checkout@v3

# cache go build cache
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG DEBIAN_VERSION=bullseye-slim
ARG GO_VERSION=1.17-buster
ARG GO_VERSION=1.18-buster

FROM golang:${GO_VERSION} AS builder

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.staging
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17
FROM golang:1.18

ARG chain="polkadot"
ARG basepath="~/.gossamer"
Expand Down
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,33 @@ For more information about Gossamer, the Polkadot ecosystem, and how to use Goss

### Prerequisites

install go version `>=1.17`
Install Go version [`>=1.18`](https://go.dev/dl/#go1.18)

### Installation

get the [ChainSafe/gossamer](https://github.com/ChainSafe/gossamer) repository:

```
git clone git@github.com:ChainSafe/gossamer
cd gossamer
```

build gossamer command:

```
make gossamer
```

### Troubleshooting for Apple Silicon users

If you are facing the following problem with the `wasmer`:

```
undefined: cWasmerImportObjectT
undefined: cWasmerImportFuncT
undefined: cWasmerValueTag
```

Make sure you have the following Golang enviroment variables:

- GOARCH="amd64"
Expand All @@ -74,8 +79,6 @@ Make sure you have the following Golang enviroment variables:
> use _go env -w **ENV_NAME**=**ENV_VALUE**_ to set the new value


### Run Development Node

To initialise a development node:
Expand All @@ -85,22 +88,25 @@ To initialise a development node:
```

To start the development node:

```
./bin/gossamer --chain dev
```

The development node is configured to produce a block every slot and to finalise a block every round (as there is only one authority, `alice`.)
The development node is configured to produce a block every slot and to finalise a block every round (as there is only one authority, `alice`.)

### Run Gossamer Node

The gossamer node runs by default as an authority with 9 authorites set at genesis. The built-in keys, corresponding to the authorities, that are available for the node are `alice`, `bob`, `charlie`, `dave`, `eve`, `ferdie`, `george`, and `ian`.

To initialise a gossamer node:

```
./bin/gossamer --chain gssmr init
```

To start the gossamer node:

```
./bin/gossamer --chain gssmr --key alice
```
Expand All @@ -112,11 +118,13 @@ Note: If you only run one gossamer node, the node will not build blocks every sl
Kusama is currently supported as a **full node**, ie. it can sync the chain but not act as an authority.

To initialise a kusama node:

```
./bin/gossamer --chain kusama init
```

To start the kusama node:

```
./bin/gossamer --chain kusama
```
Expand All @@ -128,18 +136,20 @@ The node may not appear to do anything for the first minute or so (it's bootstra
network = "debug"
```

After it's finished bootstrapping, the node should begin to sync.
After it's finished bootstrapping, the node should begin to sync.

### Run Polkadot Node

Polkadot is currently supported as a **full node**, ie. it can sync the chain but not act as an authority.

To initialise a polkadot node:

```
./bin/gossamer --chain polkadot init
```

To start the polkadot node:

```
./bin/gossamer --chain polkadot
```
Expand All @@ -159,19 +169,17 @@ Our work on gossamer is funded by grants. If you'd like to donate, you can send
### Reporting a Security Bug

We take all security issues seriously, if you believe you have found a security issue within a ChainSafe
project please notify us immediately. If an issue is confirmed, we will take all necessary precautions
project please notify us immediately. If an issue is confirmed, we will take all necessary precautions
to ensure a statement and patch release is made in a timely manner.

Please email us a description of the flaw and any related information (e.g. reproduction steps, version) to
[security at chainsafe dot io](mailto:security@chainsafe.io).


## License

_GNU Lesser General Public License v3.0_

<br />
<p align="center">
<img src="/docs/docs/assets/img/chainsafe_gopher.png">
<img src="/docs/docs/assets/img/chainsafe_gopher.png">
</p>

4 changes: 2 additions & 2 deletions devnet/alice.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2021 ChainSafe Systems (ON)
# SPDX-License-Identifier: LGPL-3.0-only

FROM golang:1.17
FROM golang:1.18

ARG POLKADOT_VERSION=v0.9.10

Expand All @@ -18,7 +18,7 @@ WORKDIR /gossamer
COPY go.mod go.sum ./
RUN go mod download

COPY . .
COPY . .

RUN go install -trimpath github.com/ChainSafe/gossamer/cmd/gossamer

Expand Down
3 changes: 1 addition & 2 deletions devnet/bob.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Copyright 2021 ChainSafe Systems (ON)
# SPDX-License-Identifier: LGPL-3.0-only


FROM golang:1.17
FROM golang:1.18

ARG POLKADOT_VERSION=v0.9.10

Expand Down
2 changes: 1 addition & 1 deletion devnet/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ChainSafe/gossamer/devnet

go 1.17
go 1.18

require (
github.com/aws/aws-sdk-go v1.42.22
Expand Down
2 changes: 1 addition & 1 deletion devnet/substrate_alice.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

ARG POLKADOT_VERSION=v0.9.10

FROM golang:1.17 as openmetrics
FROM golang:1.18 as openmetrics
ARG METRICS_NAMESPACE=substrate.local.devnet

WORKDIR /devnet
Expand Down
Loading

0 comments on commit d85a1db

Please sign in to comment.