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

Replaces Travis with Github Action #465

Merged
merged 6 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
28 changes: 28 additions & 0 deletions .github/workflows/go_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go lint

on:
push:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the push entry here, but rather protect the repository against direct pushes to master (which should be renamed to main :) and only allow merges when the tests pass.

This avoids running an unnecessary lint when you merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe redundant in some cases, but it doesn't hurt. I feel safer having a second check :)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline

64 changes: 64 additions & 0 deletions .github/workflows/go_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Go test

on:
push:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above - you can remove push if the repo is configured accordingly.

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
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 ./...`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to put the staticcheck in its own target? That would make more sense, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer having one target that gathers all vetting scripts. Except if there is a case where we need to launch staticcheck but not the other linting tools.


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 ./...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
1 change: 1 addition & 0 deletions group/curve25519/basic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build experimental
// +build experimental

package curve25519
Expand Down
1 change: 1 addition & 0 deletions group/curve25519/basic_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build experimental
// +build experimental

package curve25519
Expand Down
1 change: 1 addition & 0 deletions pairing/bn256/gfp_decl.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (amd64 && !generic) || (arm64 && !generic)
// +build amd64,!generic arm64,!generic

package bn256
Expand Down
1 change: 1 addition & 0 deletions pairing/bn256/gfp_generic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (!amd64 && !arm64) || generic
// +build !amd64,!arm64 generic

package bn256
Expand Down