From cb0459e96e4675e7685218542b64a52e2d6fc121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mien=20Kocher?= Date: Thu, 7 Jul 2022 17:00:13 +0200 Subject: [PATCH 1/5] Applies `gofmt` and `go mod tidy` --- go.sum | 3 --- group/curve25519/basic.go | 1 + group/curve25519/basic_test.go | 1 + pairing/bn256/gfp_decl.go | 1 + pairing/bn256/gfp_generic.go | 1 + 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/go.sum b/go.sum index 2a22ca0e9..c9ea88086 100644 --- a/go.sum +++ b/go.sum @@ -7,12 +7,9 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs= go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw= -go.dedis.ch/kyber/v3 v3.0.4 h1:FDuC/S3STkvwxZ0ooo3gcp56QkUKsN7Jy7cpzBxL+vQ= go.dedis.ch/kyber/v3 v3.0.4/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ= go.dedis.ch/kyber/v3 v3.0.9/go.mod h1:rhNjUUg6ahf8HEg5HUvVBYoWY4boAafX8tYxX+PS+qg= -go.dedis.ch/protobuf v1.0.5 h1:EbF1czEKICxf5KY8Tm7wMF28hcOQbB6yk4IybIFWTYE= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= -go.dedis.ch/protobuf v1.0.7 h1:wRUEiq3u0/vBhLjcw9CmAVrol+BnDyq2M0XLukdphyI= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= diff --git a/group/curve25519/basic.go b/group/curve25519/basic.go index 9eefb431e..7ef007d96 100644 --- a/group/curve25519/basic.go +++ b/group/curve25519/basic.go @@ -1,3 +1,4 @@ +//go:build experimental // +build experimental package curve25519 diff --git a/group/curve25519/basic_test.go b/group/curve25519/basic_test.go index 7667de15a..b5936ac6d 100644 --- a/group/curve25519/basic_test.go +++ b/group/curve25519/basic_test.go @@ -1,3 +1,4 @@ +//go:build experimental // +build experimental package curve25519 diff --git a/pairing/bn256/gfp_decl.go b/pairing/bn256/gfp_decl.go index be1b80906..652089de2 100644 --- a/pairing/bn256/gfp_decl.go +++ b/pairing/bn256/gfp_decl.go @@ -1,3 +1,4 @@ +//go:build (amd64 && !generic) || (arm64 && !generic) // +build amd64,!generic arm64,!generic package bn256 diff --git a/pairing/bn256/gfp_generic.go b/pairing/bn256/gfp_generic.go index 8e6be9596..7742dda4c 100644 --- a/pairing/bn256/gfp_generic.go +++ b/pairing/bn256/gfp_generic.go @@ -1,3 +1,4 @@ +//go:build (!amd64 && !arm64) || generic // +build !amd64,!arm64 generic package bn256 From cbf02ee389b6d000da72f22749bfb4645bb6ad5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mien=20Kocher?= Date: Thu, 7 Jul 2022 17:25:52 +0200 Subject: [PATCH 2/5] Adds Github actions --- .github/workflows/go_lint.yml | 28 ++++++++++++++++ .github/workflows/go_tests.yml | 61 ++++++++++++++++++++++++++++++++++ Makefile | 16 ++++++--- 3 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/go_lint.yml create mode 100644 .github/workflows/go_tests.yml diff --git a/.github/workflows/go_lint.yml b/.github/workflows/go_lint.yml new file mode 100644 index 000000000..fc75a0477 --- /dev/null +++ b/.github/workflows/go_lint.yml @@ -0,0 +1,28 @@ +name: Go lint + +on: + push: + branches: [ master ] + pull_request: + +jobs: + + lint: + runs-on: ubuntu-latest + steps: + - name: Use go >= 1.13 + uses: actions/setup-go@v3 + with: + go-version: '>=1.13' + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Tidy + run: go mod tidy && [ -z "$(git status -s)" ] + + - name: Lint + run: make lint + + - name: Vet + run: make vet \ No newline at end of file diff --git a/.github/workflows/go_tests.yml b/.github/workflows/go_tests.yml new file mode 100644 index 000000000..ad5095a73 --- /dev/null +++ b/.github/workflows/go_tests.yml @@ -0,0 +1,61 @@ +name: Go test + +on: + push: + branches: [ master ] + pull_request: + +jobs: + + test: + strategy: + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{matrix.platform}} + + steps: + - name: Use go >= 1.13 + uses: actions/setup-go@v3 + with: + go-version: '>=1.13' + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Test with coverage + if: matrix.platform == 'ubuntu-latest' + run: go test -json -covermode=count -coverprofile=profile.cov ./... > report.json + + - name: Test without coverage + if: matrix.platform == 'macos-latest' || matrix.platform == 'windows-latest' + run: go test ./... + + - name: Sonarcloud scan + if: matrix.platform == 'ubuntu-latest' + uses: sonarsource/sonarcloud-github-action@master + with: + args: > + -Dsonar.organization=dedis + -Dsonar.projectKey=dedis_kyber + -Dsonar.go.tests.reportPaths=report.json + -Dsonar.go.coverage.reportPaths=profile.cov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Send coverage + if: matrix.platform == 'ubuntu-latest' + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: profile.cov + parallel: true + + # notifies that all test jobs are finished. + finish: + needs: test + runs-on: ubuntu-latest + steps: + - uses: shogo82148/actions-goveralls@v1 + with: + parallel-finished: true \ No newline at end of file diff --git a/Makefile b/Makefile index ab8eb79cc..b971240c9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,13 @@ -.DEFAULT_GOAL := test +lint: + # Coding style static check. + @go install honnef.co/go/tools/cmd/staticcheck@latest + @go mod tidy + #staticcheck `go list ./...` -Coding/bin/Makefile.base: - git clone https://github.com/dedis/Coding -include Coding/bin/Makefile.base +vet: + go vet ./... + +# target to run all the possible checks; it's a good habit to run it before +# pushing code +check: lint vet + go test ./... \ No newline at end of file From a035bf0d48993ca9c4a7babeaf9c8d6d35687f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mien=20Kocher?= Date: Thu, 7 Jul 2022 17:26:20 +0200 Subject: [PATCH 3/5] Removes old .travis.yml --- .travis.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7c7749d61..000000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -go: - - "1.15.x" - -go_import_path: go.dedis.ch/kyber/v3 - -script: GO111MODULE=on make test - -notifications: - email: false - -# https://restic.net/blog/2018-09-02/travis-build-cache -cache: - directories: - - $HOME/.cache/go-build - - $GOPATH/pkg/mod From 1b29947aaab510f753cd8a5827ed43ade5ae67a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mien=20Kocher?= Date: Thu, 7 Jul 2022 17:38:25 +0200 Subject: [PATCH 4/5] Fixes Sonar complaints --- .github/workflows/go_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/go_tests.yml b/.github/workflows/go_tests.yml index ad5095a73..805b52af5 100644 --- a/.github/workflows/go_tests.yml +++ b/.github/workflows/go_tests.yml @@ -40,6 +40,9 @@ jobs: -Dsonar.projectKey=dedis_kyber -Dsonar.go.tests.reportPaths=report.json -Dsonar.go.coverage.reportPaths=profile.cov + -Dsonar.c.file.suffixes=- + -Dsonar.cpp.file.suffixes=- + -Dsonar.objc.file.suffixes=- env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From d71513d09431189eb67523a9faf0906c0478bfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mien=20Kocher?= Date: Fri, 8 Jul 2022 14:53:58 +0200 Subject: [PATCH 5/5] Adds missing newlines --- .github/workflows/go_lint.yml | 2 +- .github/workflows/go_tests.yml | 2 +- Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go_lint.yml b/.github/workflows/go_lint.yml index fc75a0477..d062e337b 100644 --- a/.github/workflows/go_lint.yml +++ b/.github/workflows/go_lint.yml @@ -25,4 +25,4 @@ jobs: run: make lint - name: Vet - run: make vet \ No newline at end of file + run: make vet diff --git a/.github/workflows/go_tests.yml b/.github/workflows/go_tests.yml index 805b52af5..227587dcc 100644 --- a/.github/workflows/go_tests.yml +++ b/.github/workflows/go_tests.yml @@ -61,4 +61,4 @@ jobs: steps: - uses: shogo82148/actions-goveralls@v1 with: - parallel-finished: true \ No newline at end of file + parallel-finished: true diff --git a/Makefile b/Makefile index b971240c9..7f96089b4 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,4 @@ vet: # target to run all the possible checks; it's a good habit to run it before # pushing code check: lint vet - go test ./... \ No newline at end of file + go test ./...