-
Notifications
You must be signed in to change notification settings - Fork 238
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
v2: upgrade build to include go1.21 #890
Merged
Merged
Changes from 21 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
8cf5bbc
v2: upgrade to go1.21
iand b1b4661
Add uci config
iand 3997993
Use newer uci actions
iand 77ca4ec
Fix merge conflict
iand d7feea9
Use v2 working directory in actions
iand 1299359
Set go-version input in actions
iand ce1fa35
Set go-version input in actions
iand 52555e3
Use go 1.20.8 in actions
iand 9838121
Use go 1.21.1 and relative working directory
iand f08a1ea
Try default working directory on job
iand bf14d3e
Remove uci.yaml which is not supported yet
iand 0e6e4d2
Try default working directory on job
iand 318fdaa
Try default working directory as input
iand c5768c2
Restore uci.yaml
iand 576d604
Restore uci.yaml
iand 54cc8e8
Use modified go-check
iand 3826f9d
Use modified go-test
iand f131d09
Fix go-test
iand b8662b9
Fix go-test
iand e94e01e
Fix go-test
iand 22ad479
Merge branch 'v2-develop' into v2-go121
iand 960eca4
Restore libp2p 0.30.0
iand 60e8ff2
go mod tidy
iand ebff55e
Remove nil error return from DefaultConfig
iand 45dbf25
use mock clock for IPNS record generation (#894)
dennis-tra f607a79
Use MapDatastore for provider backend tests instead of leveldb (#896)
dennis-tra 36328b1
revert some merge residuals
dennis-tra 961da3e
style: minor coding clean up (#898)
dennis-tra f28c2fc
Target go language version 1.20 and add 1.20.8 to build matrix
iand 7e13876
Target go language version 1.20 and add 1.20.8 to build matrix
iand 5665cda
WIP
iand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
files: # Configure what Unified CI templates should be used for your repository; defaults to primary language default fileset | ||
- .github/workflows/go-check.yml | ||
- .github/workflows/go-test.yml | ||
force: true # Configure whether Unified CI should overwrite existing workflows; defaults to false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
# File managed by web3-bot. DO NOT EDIT. | ||
# See https://github.com/protocol/.github/ for details. | ||
|
||
on: [push, pull_request] | ||
name: Go Checks | ||
|
||
defaults: | ||
run: | ||
working-directory: ./v2 | ||
|
||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit: | ||
runs-on: ubuntu-latest | ||
|
@@ -13,15 +27,37 @@ jobs: | |
with: | ||
submodules: recursive | ||
- id: config | ||
uses: protocol/.github/.github/actions/read-config@master | ||
- uses: actions/setup-go@v3 | ||
uses: pl-strflt/uci/.github/actions/read-config@main | ||
- id: go-mod | ||
uses: pl-strflt/uci/.github/actions/read-go-mod@main | ||
- id: go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.x | ||
go-version: '1.21.1' | ||
cache: false | ||
- name: Run repo-specific setup | ||
uses: ./.github/actions/go-check-setup | ||
if: hashFiles('./.github/actions/go-check-setup') != '' | ||
- name: Install staticcheck | ||
run: go install honnef.co/go/tools/cmd/staticcheck@4970552d932f48b71485287748246cf3237cebdf # 2023.1 (v0.4.0) | ||
env: | ||
STATICCHECK_VERSIONS: | | ||
{ | ||
"1.21": "9e12e6014d3b0a854950490051ad1338fc6badd1", | ||
"1.20": "9e12e6014d3b0a854950490051ad1338fc6badd1", | ||
"1.19": "376210a89477dedbe6fdc4484b233998650d7b3c", | ||
"1.18": "376210a89477dedbe6fdc4484b233998650d7b3c", | ||
"1.17": "c8caa92bad8c27ae734c6725b8a04932d54a147b", | ||
"1.16": "4dc1992c9bb4310ba1e98b30c8d7d46444891d3b", | ||
"1.15": "5b7de96f09104e2be384aa93a7c821eb5e77378b", | ||
"1.14": "5b7de96f09104e2be384aa93a7c821eb5e77378b", | ||
"1.13": "afd67930eec2a9ed3e9b19f684d17a062285f16a" | ||
} | ||
GO_VERSION: ${{ steps.go.outputs.go-version }} | ||
GO111MODULE: on | ||
run: | | ||
version="$(jq -nr 'env.STATICCHECK_VERSIONS | fromjson | .[env.GO_VERSION | sub("\\.[^.]+$"; "")] // "latest"')" | ||
echo "Installing staticcheck@$version" | ||
go install honnef.co/go/tools/cmd/staticcheck@$version || go get honnef.co/go/tools/cmd/staticcheck@$version | ||
- name: Check that go.mod is tidy | ||
uses: protocol/[email protected] | ||
with: | ||
|
@@ -32,6 +68,7 @@ jobs: | |
exit 1 | ||
fi | ||
git diff --exit-code -- go.sum go.mod | ||
working-directory: ./v2 | ||
- name: gofmt | ||
if: success() || failure() # run this step even if the previous one failed | ||
run: | | ||
|
@@ -45,13 +82,15 @@ jobs: | |
uses: protocol/[email protected] | ||
with: | ||
run: go vet ./... | ||
working-directory: ./v2 | ||
- name: staticcheck | ||
if: success() || failure() # run this step even if the previous one failed | ||
uses: protocol/[email protected] | ||
with: | ||
run: | | ||
set -o pipefail | ||
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g' | ||
working-directory: ./v2 | ||
- name: go generate | ||
uses: protocol/[email protected] | ||
if: (success() || failure()) && fromJSON(steps.config.outputs.json).gogenerate == true | ||
|
@@ -65,3 +104,4 @@ jobs: | |
git status --short | ||
exit 1 | ||
fi | ||
working-directory: ./v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,87 @@ | ||
# File managed by web3-bot. DO NOT EDIT. | ||
# See https://github.com/protocol/.github/ for details. | ||
|
||
on: [push, pull_request] | ||
name: Go Test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ "ubuntu", "windows", "macos" ] | ||
go: ["1.19.x","1.20.x"] | ||
go: ["1.21.1"] | ||
env: | ||
COVERAGES: "" | ||
GOTESTFLAGS: -cover -coverprofile=module-coverage.txt -coverpkg=./... | ||
GO386FLAGS: '' | ||
GORACEFLAGS: '' | ||
runs-on: ${{ fromJSON(vars[format('UCI_GO_TEST_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }} | ||
name: ${{ matrix.os }} (go ${{ matrix.go }}) | ||
steps: | ||
- name: Use msys2 on windows | ||
if: matrix.os == 'windows' | ||
# The executable for msys2 is also called bash.cmd | ||
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells | ||
# If we prepend its location to the PATH | ||
# subsequent 'shell: bash' steps will use msys2 instead of gitbash | ||
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
# Update to v4 is blocked by https://github.com/actions/setup-go/pull/411 | ||
# - uses: actions/setup-go@v4 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: stable | ||
# cache: false | ||
- id: config | ||
uses: protocol/.github/.github/actions/read-config@master | ||
uses: pl-strflt/uci/.github/actions/read-config@main | ||
- id: go-mod | ||
uses: pl-strflt/uci/.github/actions/read-go-mod@main | ||
- id: go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.1' | ||
cache: false | ||
- if: toJSON(fromJSON(steps.config.outputs.json).shuffle) != 'false' | ||
run: | | ||
echo "GOTESTFLAGS=-shuffle=on $GOTESTFLAGS" >> $GITHUB_ENV | ||
echo "GO386FLAGS=-shuffle=on $GO386FLAGS" >> $GITHUB_ENV | ||
echo "GORACEFLAGS=-shuffle=on $GORACEFLAGS" >> $GITHUB_ENV | ||
- if: toJSON(fromJSON(steps.config.outputs.json).verbose) != 'false' | ||
run: | | ||
echo "GOTESTFLAGS=-v $GOTESTFLAGS" >> $GITHUB_ENV | ||
echo "GO386FLAGS=-v $GO386FLAGS" >> $GITHUB_ENV | ||
echo "GORACEFLAGS=-v $GORACEFLAGS" >> $GITHUB_ENV | ||
# Update to v4 is blocked by https://github.com/actions/setup-go/pull/411 | ||
# - uses: actions/setup-go@v4 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
go-version: ${{ steps.go.outputs.version }} | ||
- name: Go information | ||
run: | | ||
go version | ||
go env | ||
- name: Use msys2 on windows | ||
if: matrix.os == 'windows' | ||
shell: bash | ||
# The executable for msys2 is also called bash.cmd | ||
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells | ||
# If we prepend its location to the PATH | ||
# subsequent 'shell: bash' steps will use msys2 instead of gitbash | ||
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH | ||
- name: Run repo-specific setup | ||
uses: ./.github/actions/go-test-setup | ||
if: hashFiles('./.github/actions/go-test-setup') != '' | ||
- name: Run tests | ||
if: contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false | ||
uses: protocol/[email protected] | ||
env: | ||
GOFLAGS: ${{ format('{0} {1}', env.GOTESTFLAGS, env.GOFLAGS) }} | ||
with: | ||
# Use -coverpkg=./..., so that we include cross-package coverage. | ||
# If package ./A imports ./B, and ./A's tests also cover ./B, | ||
# this means ./B's coverage will be significantly higher than 0%. | ||
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./... | ||
run: go test ./... | ||
working-directory: ./v2 | ||
- name: Run tests (32 bit) | ||
# can't run 32 bit tests on OSX. | ||
if: matrix.os != 'macos' && | ||
|
@@ -55,22 +90,28 @@ jobs: | |
uses: protocol/[email protected] | ||
env: | ||
GOARCH: 386 | ||
GOFLAGS: ${{ format('{0} {1}', env.GO386FLAGS, env.GOFLAGS) }} | ||
with: | ||
run: | | ||
export "PATH=$PATH_386:$PATH" | ||
go test -v -shuffle=on ./... | ||
go test ./... | ||
working-directory: ./v2 | ||
- name: Run tests with race detector | ||
# speed things up. Windows and OSX VMs are slow | ||
if: matrix.os == 'ubuntu' && | ||
fromJSON(steps.config.outputs.json).skipRace != true && | ||
contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false | ||
uses: protocol/[email protected] | ||
env: | ||
GOFLAGS: ${{ format('{0} {1}', env.GORACEFLAGS, env.GOFLAGS) }} | ||
with: | ||
run: go test -v -race ./... | ||
run: go test -race ./... | ||
working-directory: ./v2 | ||
- name: Collect coverage files | ||
shell: bash | ||
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV | ||
id: coverages | ||
run: echo "files=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_OUTPUT | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
with: | ||
files: '${{ env.COVERAGES }}' | ||
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }} | ||
files: ${{ steps.coverages.outputs.files }} | ||
env_vars: OS=${{ matrix.os }}, GO=${{ steps.go.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
# File managed by web3-bot. DO NOT EDIT. | ||
# See https://github.com/protocol/.github/ for details. | ||
|
||
name: Release Checker | ||
|
||
on: | ||
pull_request_target: | ||
paths: [ 'version.json' ] | ||
types: [ opened, synchronize, reopened, labeled, unlabeled ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release-check: | ||
uses: protocol/.github/.github/workflows/release-check.yml@master | ||
with: | ||
go-version: 1.20.x | ||
uses: pl-strflt/uci/.github/workflows/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# File managed by web3-bot. DO NOT EDIT. | ||
# See https://github.com/protocol/.github/ for details. | ||
|
||
name: Releaser | ||
|
||
on: | ||
push: | ||
paths: [ 'version.json' ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
releaser: | ||
uses: protocol/.github/.github/workflows/releaser.yml@master | ||
uses: pl-strflt/uci/.github/workflows/releaser.yml@v0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
# File managed by web3-bot. DO NOT EDIT. | ||
# See https://github.com/protocol/.github/ for details. | ||
|
||
name: Tag Push Checker | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
releaser: | ||
uses: protocol/.github/.github/workflows/tagpush.yml@master | ||
uses: pl-strflt/uci/.github/workflows/tagpush.yml@v0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a result from a merge. We don't need an error return value here. This is the source for the comparatively large diff here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed in the next PR in the chain #887
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove here though - didn't realise there were so many