From 523a9c8afd491c82701b1e1811738b197a951d5c Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:49:19 +0000 Subject: [PATCH 01/11] add version.json file --- version.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 version.json diff --git a/version.json b/version.json new file mode 100644 index 00000000..c8da44de --- /dev/null +++ b/version.json @@ -0,0 +1,3 @@ +{ + "version": "v0.0.7" +} From 55c3c0097977fcd46497fbfbb169d1cce059d69a Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:44 +0000 Subject: [PATCH 02/11] bump go.mod to Go 1.16 and run go fix --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f91b07bf..e09148a6 100644 --- a/go.mod +++ b/go.mod @@ -6,4 +6,4 @@ require ( golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect ) -go 1.12 +go 1.16 From 19eed5d76f3e62b44a571dbfbdd2661edb52498c Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 03/11] run gofmt -s --- build.go | 1 + build_static.go | 1 + init_posix.go | 1 + init_windows.go | 1 + 4 files changed, 4 insertions(+) diff --git a/build.go b/build.go index d3f19d82..990fbb4b 100644 --- a/build.go +++ b/build.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !openssl_static // +build !openssl_static package openssl diff --git a/build_static.go b/build_static.go index 69fad0a4..dde54461 100644 --- a/build_static.go +++ b/build_static.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build openssl_static // +build openssl_static package openssl diff --git a/init_posix.go b/init_posix.go index 605a24bc..f518d2f8 100644 --- a/init_posix.go +++ b/init_posix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build (linux || darwin || solaris || freebsd || openbsd) && !windows // +build linux darwin solaris freebsd openbsd // +build !windows diff --git a/init_windows.go b/init_windows.go index 051133c3..7356b6e2 100644 --- a/init_windows.go +++ b/init_windows.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build windows // +build windows package openssl From ed6a5ab6c119a3e66b65a3614097e8ee69766a6a Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 04/11] add .github/workflows/automerge.yml --- .github/workflows/automerge.yml | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000..44fad65f --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,53 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass. +# This reduces the friction associated with updating with our workflows. + +on: [ pull_request ] +name: Automerge + +jobs: + automerge-check: + if: github.event.pull_request.user.login == 'web3-bot' + runs-on: ubuntu-latest + outputs: + status: ${{ steps.should-automerge.outputs.status }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Check if we should automerge + id: should-automerge + run: | + for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do + committer=$(git show --format=$'%ce' -s $commit) + echo "Committer: $committer" + if [[ "$committer" != "web3-bot@users.noreply.github.com" ]]; then + echo "Commit $commit wasn't committed by web3-bot, but by $committer." + echo "::set-output name=status::false" + exit + fi + done + echo "::set-output name=status::true" + automerge: + needs: automerge-check + runs-on: ubuntu-latest + # The check for the user is redundant here, as this job depends on the automerge-check job, + # but it prevents this job from spinning up, just to be skipped shortly after. + if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true' + steps: + - name: Wait on tests + uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + running-workflow-name: 'automerge' # the name of this job + - name: Merge PR + uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + MERGE_LABELS: "" + MERGE_METHOD: "squash" + MERGE_DELETE_BRANCH: true From f0bfe9c3699959f7bbda386b2dfee2d61a30291d Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 05/11] add .github/workflows/go-test.yml --- .github/workflows/go-test.yml | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/go-test.yml diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 00000000..606e0c7f --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,66 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +on: [push, pull_request] +name: Go Test + +jobs: + unit: + strategy: + fail-fast: false + matrix: + os: [ "ubuntu", "windows", "macos" ] + go: [ "1.16.x", "1.17.x" ] + env: + COVERAGES: "" + runs-on: ${{ matrix.os }}-latest + name: ${{ matrix.os}} (go ${{ matrix.go }}) + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - 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 + uses: protocol/multiple-go-modules@v1.2 + 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 -coverprofile=module-coverage.txt -coverpkg=./... ./... + - name: Run tests (32 bit) + if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. + uses: protocol/multiple-go-modules@v1.2 + env: + GOARCH: 386 + with: + run: go test -v ./... + - name: Run tests with race detector + if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow + uses: protocol/multiple-go-modules@v1.2 + with: + run: go test -v -race ./... + - name: Collect coverage files + shell: bash + run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV + - name: Upload coverage to Codecov + uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + with: + files: '${{ env.COVERAGES }}' + env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }} From 0ce1691392bb3fbd7885969604af3151d7596b65 Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 06/11] add .github/workflows/go-check.yml --- .github/workflows/go-check.yml | 74 ++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/go-check.yml diff --git a/.github/workflows/go-check.yml b/.github/workflows/go-check.yml new file mode 100644 index 00000000..e127cf17 --- /dev/null +++ b/.github/workflows/go-check.yml @@ -0,0 +1,74 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +on: [push, pull_request] +name: Go Checks + +jobs: + unit: + runs-on: ubuntu-latest + name: All + env: + RUNGOGENERATE: false + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-go@v2 + with: + go-version: "1.17.x" + - name: Run repo-specific setup + uses: ./.github/actions/go-check-setup + if: hashFiles('./.github/actions/go-check-setup') != '' + - name: Read config + if: hashFiles('./.github/workflows/go-check-config.json') != '' + run: | + if jq -re .gogenerate ./.github/workflows/go-check-config.json; then + echo "RUNGOGENERATE=true" >> $GITHUB_ENV + fi + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@c8caa92bad8c27ae734c6725b8a04932d54a147b # 2021.1.2 (v0.2.2) + - name: Check that go.mod is tidy + uses: protocol/multiple-go-modules@v1.2 + with: + run: | + go mod tidy + if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then + echo "go.sum was added by go mod tidy" + exit 1 + fi + git diff --exit-code -- go.sum go.mod + - name: gofmt + if: ${{ success() || failure() }} # run this step even if the previous one failed + run: | + out=$(gofmt -s -l .) + if [[ -n "$out" ]]; then + echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}' + exit 1 + fi + - name: go vet + if: ${{ success() || failure() }} # run this step even if the previous one failed + uses: protocol/multiple-go-modules@v1.2 + with: + run: go vet ./... + - name: staticcheck + if: ${{ success() || failure() }} # run this step even if the previous one failed + uses: protocol/multiple-go-modules@v1.2 + with: + run: | + set -o pipefail + staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g' + - name: go generate + uses: protocol/multiple-go-modules@v1.2 + if: (success() || failure()) && env.RUNGOGENERATE == 'true' + with: + run: | + git clean -fd # make sure there aren't untracked files / directories + go generate ./... + # check if go generate modified or added any files + if ! $(git add . && git diff-index HEAD --exit-code --quiet); then + echo "go generated caused changes to the repository:" + git status --short + exit 1 + fi + From 4ce5b6775738fbbeb086acb66cf78747b22d414b Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 07/11] add .github/workflows/releaser.yml --- .github/workflows/releaser.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/releaser.yml diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml new file mode 100644 index 00000000..cdccbf87 --- /dev/null +++ b/.github/workflows/releaser.yml @@ -0,0 +1,11 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +name: Releaser +on: + push: + paths: [ 'version.json' ] + +jobs: + releaser: + uses: protocol/.github/.github/workflows/releaser.yml@master From e7bb135bd6891f0516f466abad4d4d652ff76d1a Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 08/11] add .github/workflows/release-check.yml --- .github/workflows/release-check.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/release-check.yml diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml new file mode 100644 index 00000000..fde81c1f --- /dev/null +++ b/.github/workflows/release-check.yml @@ -0,0 +1,11 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +name: Release Checker +on: + pull_request: + paths: [ 'version.json' ] + +jobs: + release-check: + uses: protocol/.github/.github/workflows/release-check.yml@master From 0e129fb7c4bae77d67fb382c5a2221446139eaff Mon Sep 17 00:00:00 2001 From: web3-bot Date: Fri, 10 Dec 2021 11:50:47 +0000 Subject: [PATCH 09/11] add .github/workflows/tagpush.yml --- .github/workflows/tagpush.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/tagpush.yml diff --git a/.github/workflows/tagpush.yml b/.github/workflows/tagpush.yml new file mode 100644 index 00000000..d8499618 --- /dev/null +++ b/.github/workflows/tagpush.yml @@ -0,0 +1,12 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +name: Tag Push Checker +on: + push: + tags: + - v* + +jobs: + releaser: + uses: protocol/.github/.github/workflows/tagpush.yml@master From 77c1db38dac0f0b9c911282f34dbae90fc7ccf80 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 31 Jan 2022 13:12:13 +0100 Subject: [PATCH 10/11] update .github/workflows/go-test.yml --- .github/workflows/go-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 606e0c7f..5f77540f 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -13,8 +13,8 @@ jobs: go: [ "1.16.x", "1.17.x" ] env: COVERAGES: "" - runs-on: ${{ matrix.os }}-latest - name: ${{ matrix.os}} (go ${{ matrix.go }}) + runs-on: ${{ format('{0}-latest', matrix.os) }} + name: ${{ matrix.os }} (go ${{ matrix.go }}) steps: - uses: actions/checkout@v2 with: @@ -50,7 +50,9 @@ jobs: env: GOARCH: 386 with: - run: go test -v ./... + run: | + export "PATH=${{ env.PATH_386 }}:$PATH" + go test -v ./... - name: Run tests with race detector if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow uses: protocol/multiple-go-modules@v1.2 From b84a4bc4e9b0a2f225c9920ad6b5aa5a6ed1de55 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 31 Jan 2022 13:12:23 +0100 Subject: [PATCH 11/11] add go-test-setup action --- .github/actions/go-test-setup/action.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/actions/go-test-setup/action.yml diff --git a/.github/actions/go-test-setup/action.yml b/.github/actions/go-test-setup/action.yml new file mode 100644 index 00000000..54a5152b --- /dev/null +++ b/.github/actions/go-test-setup/action.yml @@ -0,0 +1,24 @@ +name: Go Test Setup +description: Set up the environment for go test +runs: + using: "composite" + steps: + - name: Common setup + shell: bash + run: | + echo 'CGO_ENABLED=1' >> $GITHUB_ENV + - name: Windows setup + shell: bash + if: ${{ runner.os == 'Windows' }} + run: | + echo '/c/msys64/mingw64/bin' >> $GITHUB_PATH + echo 'PATH_386=/c/msys64/mingw32/bin:${{ env.PATH_386 }}' >> $GITHUB_ENV + - name: Linux setup + shell: bash + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt-get install gcc-multilib + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install libssl-dev:i386 + echo 'CC_FOR_linux_386=i686-w64-mingw32-gcc'