-
Notifications
You must be signed in to change notification settings - Fork 168
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
Changes from 5 commits
cb0459e
cbf02ee
a035bf0
1b29947
a0f8576
d71513d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add newline |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Go test | ||
|
||
on: | ||
push: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above - you can remove |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing newline |
This file was deleted.
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 ./...` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ./... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing newline |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build experimental | ||
// +build experimental | ||
|
||
package curve25519 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build experimental | ||
// +build experimental | ||
|
||
package curve25519 | ||
|
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 | ||
|
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 | ||
|
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.
We don't use the
push
entry here, but rather protect the repository against direct pushes tomaster
(which should be renamed tomain
:) and only allow merges when the tests pass.This avoids running an unnecessary lint when you merge.
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.
Maybe redundant in some cases, but it doesn't hurt. I feel safer having a second check :)