From 90fdf941e381f2108e590b8deec9081f4eb1a1f7 Mon Sep 17 00:00:00 2001 From: cskh Date: Thu, 28 Jul 2022 11:30:21 -0400 Subject: [PATCH 1/4] Upgrade golang.org/x/sys to make it work on go1.18 --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 1b83a4f28..454def300 100644 --- a/go.mod +++ b/go.mod @@ -15,4 +15,5 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 github.com/stretchr/testify v1.2.2 + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect ) diff --git a/go.sum b/go.sum index 15d34bfc6..77c464116 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 81fb40e06a71244234c0183eee056ac12f110d93 Mon Sep 17 00:00:00 2001 From: cskh Date: Thu, 28 Jul 2022 14:50:30 -0400 Subject: [PATCH 2/4] move job to github action --- .circleci/config.yml | 16 ++--- .github/workflows/check.yml | 119 ++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/check.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index a6eebf2db..49ba80cf4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,11 +46,11 @@ jobs: - store_artifacts: path: /tmp/test-results -workflows: - version: 2 - go-tests: - jobs: - - go-fmt-and-vet - - go-tests: - requires: - - go-fmt-and-vet +# workflows: +# version: 2 +# go-tests: +# jobs: +# - go-fmt-and-vet +# - go-tests: +# requires: +# - go-fmt-and-vet diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 000000000..0fbb20988 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,119 @@ +name: Checks + +on: + pull_request: + +# This workflow runs for not-yet-reviewed external contributions and so it +# intentionally has no write access and only limited read access to the +# repository. +permissions: + contents: read + +jobs: + unit-tests: + name: "Unit Tests" + runs-on: ubuntu-latest + strategy: + matrix: + GO_VERSION: [ "1.16","1.17","1.18" ] + steps: + - name: "Fetch source code" + uses: actions/checkout@v2 + + - name: Install Go toolchain + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.GO_VERSION }} + + # NOTE: This cache is shared so the following step must always be + # identical across the unit-tests, e2e-tests, and consistency-checks + # jobs, or else weird things could happen. + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }} + restore-keys: | + go-mod-${{ matrix.GO_VERSION }} + - name: "Unit tests" + run: | + go test ./... + + unit-tests-race: + name: "Unit Tests Race" + runs-on: ubuntu-latest + strategy: + matrix: + GO_VERSION: [ "1.16","1.17","1.18" ] + steps: + - name: "Fetch source code" + uses: actions/checkout@v2 + + - name: Install Go toolchain + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.GO_VERSION }} + + # NOTE: This cache is shared so the following step must always be + # identical across the unit-tests, e2e-tests, and consistency-checks + # jobs, or else weird things could happen. + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }} + restore-keys: | + go-mod-${{ matrix.GO_VERSION }} + - name: "Race Unit tests" + run: | + go test -race ./... + + consistency-checks: + name: "Code Consistency Checks" + runs-on: ubuntu-latest + strategy: + matrix: + GO_VERSION: [ "1.16","1.17","1.18" ] + steps: + - name: "Fetch source code" + uses: actions/checkout@v2 + + - name: Install Go toolchain + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.GO_VERSION }} + + # NOTE: This cache is shared so the following step must always be + # identical across the unit-tests and consistency-checks + # jobs, or else weird things could happen. + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }} + restore-keys: | + go-mod-${{ matrix.GO_VERSION }} + - name: "go.mod and go.sum consistency check" + run: | + go mod tidy + if [[ -n "$(git status --porcelain)" ]]; then + echo >&2 "ERROR: go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files." + exit 1 + fi + - name: "go vet" + run: | + go vet ./... + - name: "go fmt check" + run: | + files=$(go fmt ./...) + if [ -n "$files" ]; then + echo "The following file(s) do not conform to go fmt:" + echo "$files" + exit 1 + fi \ No newline at end of file From 4cdafa683ca26359e218311ada1d742f06c18374 Mon Sep 17 00:00:00 2001 From: cskh Date: Thu, 28 Jul 2022 14:52:37 -0400 Subject: [PATCH 3/4] fix mod --- go.sum | 1 - 1 file changed, 1 deletion(-) diff --git a/go.sum b/go.sum index 77c464116..c26961121 100644 --- a/go.sum +++ b/go.sum @@ -39,7 +39,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From a87a7dd9d9bbf8b9c17712c00ae30b19694f6c94 Mon Sep 17 00:00:00 2001 From: cskh Date: Thu, 28 Jul 2022 14:53:32 -0400 Subject: [PATCH 4/4] remove circle ci and upgrade mod --- .circleci/config.yml | 56 -------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 49ba80cf4..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2.1 - -# reusable 'executor' object for jobs -executors: - go: - docker: - - image: docker.mirror.hashicorp.services/circleci/golang:1.16 - environment: - - TEST_RESULTS: /tmp/test-results # path to where test results are saved - -jobs: - go-fmt-and-vet: - executor: go - steps: - - checkout - - run: go mod download - - # check go fmt output because it does not report non-zero when there are fmt changes - - run: - name: check go fmt - command: | - files=$(go fmt ./...) - if [ -n "$files" ]; then - echo "The following file(s) do not conform to go fmt:" - echo "$files" - exit 1 - fi - - run: go vet ./... - - go-tests: - executor: go - steps: - - checkout - - run: mkdir -p $TEST_RESULTS - - # Restore go module cache if there is one - - restore_cache: - keys: - - memberlist-modcache-v1-{{ checksum "go.mod" }} - - # run go tests with gotestsum - - run: | - gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- -race - - store_test_results: - path: /tmp/test-results - - store_artifacts: - path: /tmp/test-results - -# workflows: -# version: 2 -# go-tests: -# jobs: -# - go-fmt-and-vet -# - go-tests: -# requires: -# - go-fmt-and-vet