Skip to content

Commit

Permalink
ci: fix slack integration + adds golanglint-ci (#316)
Browse files Browse the repository at this point in the history
* build: update github action workflow with slack notif and golanglint ci

* build: fix golanglint ci warnings
  • Loading branch information
gbotrel committed May 10, 2022
1 parent 4816350 commit dc6b1bc
Show file tree
Hide file tree
Showing 23 changed files with 222 additions and 142 deletions.
47 changes: 40 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
- name: install deps
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
- name: gofmt
Expand Down Expand Up @@ -74,17 +78,46 @@ jobs:
run: |
go test -v -short -timeout=30m ./...
slack-workflow-status:
if: always()
slack-workflow-status-failed:
if: failure()
name: post workflow status to slack
needs:
- staticcheck
- test
runs-on: ubuntu-latest
steps:
- name: Notify slack -- workflow failed
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
payload: |
{
"actor": "${{ github.actor }}",
"repo": "${{ github.repository }}",
"status": "FAIL",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

slack-workflow-status-success:
if: success()
name: post workflow status to slack
needs:
- staticcheck
- test
runs-on: ubuntu-latest
steps:
- name: Build notification
uses: Gamesight/slack-workflow-status@master
- name: Notify slack -- workflow succeeded
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
channel: '#team-gnark-build'
payload: |
{
"actor": "${{ github.actor }}",
"repo": "${{ github.repository }}",
"status": "SUCCESS",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }}
47 changes: 40 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
- name: install deps
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
- name: gofmt
Expand Down Expand Up @@ -82,17 +86,46 @@ jobs:
run: |
go test -v -timeout=50m -race -short ./...
slack-workflow-status:
if: always()
slack-workflow-status-failed:
if: failure()
name: post workflow status to slack
needs:
- staticcheck
- test
runs-on: ubuntu-latest
steps:
- name: Notify slack -- workflow failed
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
payload: |
{
"actor": "${{ github.actor }}",
"repo": "${{ github.repository }}",
"status": "FAIL",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

slack-workflow-status-success:
if: success()
name: post workflow status to slack
needs:
- staticcheck
- test
runs-on: ubuntu-latest
steps:
- name: Build notification
uses: Gamesight/slack-workflow-status@master
- name: Notify slack -- workflow succeeded
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
channel: '#team-gnark-build'
payload: |
{
"actor": "${{ github.actor }}",
"repo": "${{ github.repository }}",
"status": "SUCCESS",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }}
2 changes: 1 addition & 1 deletion backend/groth16/bellman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestVerifyBellmanProof(t *testing.T) {
// verify groth16 proof
// we need to prepend the number of elements in the witness.
var buf bytes.Buffer
binary.Write(&buf, binary.BigEndian, uint32(len(inputsBytes)/(fr.Limbs*8)))
_ = binary.Write(&buf, binary.BigEndian, uint32(len(inputsBytes)/(fr.Limbs*8)))
buf.Write(inputsBytes)

witness := &witness.Witness{
Expand Down
3 changes: 1 addition & 2 deletions frontend/compiled/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const (
const TermDelimitor Term = Term(maskDelimitor)

const (
shiftWireID = 0
shiftCoeffID = nbBitsWireID
shiftDelimitor = shiftCoeffID + nbBitsCoeffID
shiftFutureUse = shiftDelimitor + nbBitsDelimitor
Expand All @@ -67,7 +66,7 @@ const (
maskWireID = uint64((1 << nbBitsWireID) - 1)
maskCoeffID = uint64((1<<nbBitsCoeffID)-1) << shiftCoeffID
maskDelimitor = uint64((1<<nbBitsDelimitor)-1) << shiftDelimitor
maskFutureUse = uint64((1<<nbBitsFutureUse)-1) << shiftFutureUse
_ = uint64((1<<nbBitsFutureUse)-1) << shiftFutureUse
maskVariableVisibility = uint64((1<<nbBitsVariableVisibility)-1) << shiftVariableVisibility
)

Expand Down
2 changes: 1 addition & 1 deletion internal/utils/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestFromInterfaceValidFormats(t *testing.T) {
}()

var a fr.Element
a.SetRandom()
_, _ = a.SetRandom()

_ = FromInterface(a)
_ = FromInterface(&a)
Expand Down
36 changes: 18 additions & 18 deletions std/algebra/fields_bls12377/e12_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func TestAddFp12(t *testing.T) {

// witness values
var a, b, c bls12377.E12
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Add(&a, &b)

witness.A.Assign(&a)
Expand Down Expand Up @@ -78,8 +78,8 @@ func TestSubFp12(t *testing.T) {

// witness values
var a, b, c bls12377.E12
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Sub(&a, &b)

witness.A.Assign(&a)
Expand Down Expand Up @@ -110,8 +110,8 @@ func TestMulFp12(t *testing.T) {

// witness values
var a, b, c bls12377.E12
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Mul(&a, &b)

witness.A.Assign(&a)
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestSquareFp12(t *testing.T) {

// witness values
var a, b bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()
b.Square(&a)

witness.A.Assign(&a)
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestFp12CyclotomicSquare(t *testing.T) {

// witness values
var a, b bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()

// put a in the cyclotomic subgroup (we assume the group is Fp12, field of definition of bls277)
var tmp bls12377.E12
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestFp12CyclotomicSquareCompressed(t *testing.T) {

// witness values
var a, b bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()

// put a in the cyclotomic subgroup (we assume the group is Fp12, field of definition of bls277)
var tmp bls12377.E12
Expand Down Expand Up @@ -253,7 +253,7 @@ func TestConjugateFp12(t *testing.T) {

// witness values
var a, c bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()
c.Conjugate(&a)

witness.A.Assign(&a)
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestFrobeniusFp12(t *testing.T) {

// witness values
var a, c, d, e bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()
c.Frobenius(&a)
d.FrobeniusSquare(&a)
e.FrobeniusCube(&a)
Expand Down Expand Up @@ -325,7 +325,7 @@ func TestInverseFp12(t *testing.T) {

// witness values
var a, c bls12377.E12
a.SetRandom()
_, _ = a.SetRandom()
c.Inverse(&a)

witness.A.Assign(&a)
Expand All @@ -352,8 +352,8 @@ func TestDivFp12(t *testing.T) {

// witness values
var a, b, c bls12377.E12
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Inverse(&b).Mul(&c, &a)

var witness e12Div
Expand Down Expand Up @@ -387,7 +387,7 @@ func TestExpFixedExpoFp12(t *testing.T) {
expo := uint64(9586122913090633729)

// put a in the cyclotomic subgroup (we assume the group is Fp12, field of definition of bls277)
a.SetRandom()
_, _ = a.SetRandom()
b.Conjugate(&a)
a.Inverse(&a)
b.Mul(&b, &a)
Expand Down Expand Up @@ -423,13 +423,13 @@ func TestFp12MulBy034(t *testing.T) {
var a bls12377.E12
var b, c, one bls12377.E2
one.SetOne()
a.SetRandom()
_, _ = a.SetRandom()
witness.A.Assign(&a)

b.SetRandom()
_, _ = b.SetRandom()
witness.B.Assign(&b)

c.SetRandom()
_, _ = c.SetRandom()
witness.C.Assign(&c)

a.MulBy034(&one, &b, &c)
Expand Down
24 changes: 12 additions & 12 deletions std/algebra/fields_bls12377/e2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestAddFp2(t *testing.T) {

// witness values
var a, b, c bls12377.E2
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Add(&a, &b)

var witness e2Add
Expand Down Expand Up @@ -71,8 +71,8 @@ func TestSubFp2(t *testing.T) {

// witness values
var a, b, c bls12377.E2
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Sub(&a, &b)

var witness e2Sub
Expand Down Expand Up @@ -101,8 +101,8 @@ func TestMulFp2(t *testing.T) {

// witness values
var a, b, c bls12377.E2
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Mul(&a, &b)

var witness e2Mul
Expand Down Expand Up @@ -131,8 +131,8 @@ func TestDivFp2(t *testing.T) {

// witness values
var a, b, c bls12377.E2
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.Inverse(&b).Mul(&c, &a)

var witness e2Div
Expand Down Expand Up @@ -166,8 +166,8 @@ func TestMulByFpFp2(t *testing.T) {
// witness values
var a, c bls12377.E2
var b fp.Element
a.SetRandom()
b.SetRandom()
_, _ = a.SetRandom()
_, _ = b.SetRandom()
c.MulByElement(&a, &b)

witness.A.Assign(&a)
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestConjugateFp2(t *testing.T) {

// witness values
var a, c bls12377.E2
a.SetRandom()
_, _ = a.SetRandom()
c.Conjugate(&a)

witness.A.Assign(&a)
Expand Down Expand Up @@ -230,7 +230,7 @@ func TestInverseFp2(t *testing.T) {

// witness values
var a, c bls12377.E2
a.SetRandom()
_, _ = a.SetRandom()
c.Inverse(&a)

witness.A.Assign(&a)
Expand Down

0 comments on commit dc6b1bc

Please sign in to comment.