Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade golang to 1.18 #89

Merged
merged 17 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/autopr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ on:
push:
branches:
- release/*

jobs:
create-pull-request:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v2

uses: actions/checkout@v3
- name: pull-request
uses: repo-sync/pull-request@v2
with:
Expand Down
72 changes: 41 additions & 31 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
name: Build & Push
# Build & Push builds the simapp docker image on every push to master and
# Build & Push builds the lbm docker image on every tag push,
# and pushes the image to https://docker-registry.linecorp.com/link-network/v2/lbm
on:
pull_request:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

# push:
# tags:
# - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
# - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
env:
registry: docker-registry.linecorp.com
repository: link-network/v2/lbm
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=line/lbm
VERSION=noop
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=latest
fi
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Create a context for buildx
run: docker context create buildx
- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: buildx
config-inline: |
[registry."docker.io"]
mirrors = ["docker-hub-mirror.linecorp.com"]
- name: login to the registry
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ${{env.registry}}
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
0Tech marked this conversation as resolved.
Show resolved Hide resolved
- name: extract metadata for docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.registry}}/${{env.repository}}
tags: |
type=semver,pattern={{version}}
- name: docker build
uses: docker/build-push-action@v3
with:
push: ${{github.event_name != 'pull_request'}}
build-args: ARCH=x86_64
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}
platforms: linux/amd64
11 changes: 7 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ jobs:
runs-on: self-hosted
timeout-minutes: 6
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@master
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.18
- uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.39
version: v1.47.0
args: --timeout 10m
github-token: ${{ secrets.TOKEN }}
if: env.GIT_DIFF
42 changes: 21 additions & 21 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: self-hosted
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- run: make build
Expand All @@ -33,9 +33,9 @@ jobs:
runs-on: self-hosted
needs: build
steps:
- uses: actions/setup-go@v2.1.3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- name: Install runsim
Expand All @@ -49,13 +49,13 @@ jobs:
runs-on: self-hosted
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.go
Expand All @@ -75,13 +75,13 @@ jobs:
runs-on: self-hosted
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6.1.0
with:
SUFFIX_FILTER: |
**/**.go
Expand All @@ -103,13 +103,13 @@ jobs:
runs-on: self-hosted
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6.1.0
with:
SUFFIX_FILTER: |
**/**.go
Expand All @@ -131,13 +131,13 @@ jobs:
runs-on: self-hosted
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6.1.0
with:
SUFFIX_FILTER: |
**/**.go
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
release:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v2.1.3
uses: actions/setup-go@v3.2.1
with:
go-version: 1.15
go-version: 1.18
# - name: Unshallow
# run: git fetch --prune --unshallow
- name: Create release
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
args: release --rm-dist --release-notes ./RELEASE_CHANGELOG.md
env:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
go.sum
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
if: env.GIT_DIFF

split-test-files:
runs-on: self-hosted
Expand Down Expand Up @@ -101,9 +102,11 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock goleveldb'
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
Expand All @@ -123,17 +126,22 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-coverage"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-coverage"
if: env.GIT_DIFF
- run: |
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt
if: env.GIT_DIFF
- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
Expand All @@ -145,10 +153,12 @@ jobs:
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: env.GIT_DIFF
- uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
if: env.GIT_DIFF

test-integration:
runs-on: self-hosted
Expand All @@ -171,9 +181,11 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -tags='cli_test goleveldb' | tee ${{ matrix.part }}-integration-output.txt
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-integration-output"
Expand All @@ -194,21 +206,27 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-integration-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-integration-output"
if: env.GIT_DIFF
- uses: actions/cache@v3.0.5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
if: env.GIT_DIFF
- name: Generate integration test report
run: cat ./*-integration-output.txt | ~/go/bin/tparse
if: env.GIT_DIFF

test-integration-multi-node:
runs-on: self-hosted
Expand All @@ -231,9 +249,11 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test report creation
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -tags='cli_multi_node_test goleveldb' | tee ${{ matrix.part }}-integration-multi-node-output.txt
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-integration-multi-node-output"
Expand All @@ -254,21 +274,27 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-00-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-01-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-02-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-03-integration-multi-node-output"
if: env.GIT_DIFF
- uses: actions/cache@v3.0.5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
if: env.GIT_DIFF
- name: Generate multi node integration test report
run: cat ./*-integration-multi-node-output.txt | ~/go/bin/tparse
if: env.GIT_DIFF

test-localnet-blocks:
runs-on: self-hosted
Expand All @@ -278,6 +304,8 @@ jobs:
- uses: actions/setup-go@v3.2.1
with:
go-version: 1.18
- name: Install docker-compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
- name: Start localnet
run: |
make localnet-start
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ run:
# include test files or not, default is true
tests: true

# set tags for the integration tests
build-tags:
- cli_test
- cli_multi_test
Loading