forked from Consensys/gnark
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Consensys:master' into master
- Loading branch information
Showing
215 changed files
with
9,560 additions
and
2,441 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
on: pull_request | ||
name: pull_request | ||
|
||
jobs: | ||
staticcheck: | ||
runs-on: ubuntu-latest | ||
|
@@ -9,9 +10,9 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
- name: install Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
go-version: 1.23.x | ||
|
||
- name: install deps | ||
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | ||
|
@@ -24,37 +25,30 @@ jobs: | |
git update-index --assume-unchanged go.sum | ||
if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi | ||
# hack to ensure golanglint process generated files | ||
- name: remove "generated by" comments from generated files | ||
run: | | ||
find . -type f -name '*.go' -exec sed -i 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; | ||
# on macos: find . -type f -name '*.go' -exec sed -i '' -E 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.54 | ||
version: v1.60 | ||
args: -v --timeout=5m | ||
skip-pkg-cache: true | ||
|
||
test: | ||
runs-on: ubuntu-22.04-16core | ||
needs: staticcheck | ||
runs-on: ubuntu-latest-128 | ||
permissions: | ||
pull-requests: write | ||
outputs: | ||
failures: ${{ steps.generate-job-summary.outputs.failures }} | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
- name: install Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
go-version: 1.23.x | ||
|
||
- name: install deps | ||
run: | | ||
go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | ||
go install github.com/consensys/gnark-solidity-checker@latest | ||
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.12.0 | ||
go install github.com/consensys/gnark-solidity-checker@v0.1.0 | ||
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.8 | ||
sudo add-apt-repository ppa:ethereum/ethereum | ||
sudo apt-get update | ||
sudo apt-get install solc | ||
|
@@ -76,62 +70,18 @@ jobs: | |
go test -json -v -p 4 -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log | ||
go test -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log | ||
- name: Generate job summary | ||
id: generate-job-summary | ||
if: ${{ always() }} | ||
run: | | ||
if [ -s /tmp/gotest.log ]; then | ||
cat /tmp/gotest.log > $GITHUB_STEP_SUMMARY | ||
echo "failures=$(cat /tmp/gotest.log | node .github/parse-tests.js)" > $GITHUB_OUTPUT | ||
else | ||
echo "## Success ✅" > $GITHUB_STEP_SUMMARY | ||
echo "failures=" > $GITHUB_OUTPUT | ||
fi | ||
slack-workflow-status-failed: | ||
if: failure() | ||
name: post workflow status to slack | ||
slack-notifications: | ||
if: always() | ||
uses: ./.github/workflows/slack-notifications.yml | ||
needs: | ||
- staticcheck | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notify slack -- workflow failed | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"actor": "${{ github.actor }}", | ||
"repo": "${{ github.repository }}", | ||
"status": "FAIL", | ||
"title": "${{ github.event.pull_request.title }}", | ||
"pr": "${{ github.event.pull_request.head.ref }}", | ||
"failed_step_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/", | ||
"message": "${{ needs.test.outputs.failures }}" | ||
} | ||
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: Notify slack -- workflow succeeded | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"actor": "${{ github.actor }}", | ||
"repo": "${{ github.repository }}", | ||
"status": "SUCCESS", | ||
"title": "${{ github.event.pull_request.title }}", | ||
"pr": "${{ github.event.pull_request.head.ref }}" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }} | ||
secrets: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
status: ${{ needs.staticcheck.result }}${{ needs.test.result }} | ||
actor: ${{ github.actor }} | ||
repository: ${{ github.repository }} | ||
branch: ${{ github.event.pull_request.head.ref }} | ||
run_id: ${{ github.run_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ on: | |
branches: | ||
- 'master' | ||
name: push_master | ||
|
||
jobs: | ||
staticcheck: | ||
runs-on: ubuntu-latest | ||
|
@@ -12,9 +13,9 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
- name: install Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
go-version: 1.23.x | ||
|
||
- name: install deps | ||
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | ||
|
@@ -27,41 +28,35 @@ jobs: | |
git update-index --assume-unchanged go.sum | ||
if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi | ||
# hack to ensure golanglint process generated files | ||
- name: remove "generated by" comments from generated files | ||
run: | | ||
find . -type f -name '*.go' -exec sed -i 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; | ||
# on macos: find . -type f -name '*.go' -exec sed -i '' -E 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.54 | ||
version: v1.60 | ||
args: -v --timeout=5m | ||
skip-pkg-cache: true | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.21.x] | ||
os: [ubuntu-22.04-16core, windows-latest, macos-latest] | ||
go-version: [1.23.x] | ||
os: [ubuntu-latest-128, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- staticcheck | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
- name: install Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: install deps | ||
run: | | ||
go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | ||
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.12.0 | ||
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.8 | ||
- name: install solc deps | ||
if: startsWith(matrix.os, 'ubuntu') == true | ||
run: | | ||
go install github.com/consensys/gnark-solidity-checker@latest | ||
go install github.com/consensys/gnark-solidity-checker@v0.1.0 | ||
sudo add-apt-repository ppa:ethereum/ethereum | ||
sudo apt-get update | ||
sudo apt-get install solc | ||
|
@@ -82,51 +77,18 @@ jobs: | |
go test -v -p 4 -timeout=50m -tags=release_checks -short -race ./test/... | ||
go test -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils | ||
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/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"actor": "${{ github.actor }}", | ||
"repo": "${{ github.repository }}", | ||
"status": "FAIL", | ||
"title": "push to master ⚠", | ||
"pr": "", | ||
"failed_step_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/", | ||
"message": "" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
slack-workflow-status-success: | ||
if: success() | ||
name: post workflow status to slack | ||
slack-notifications: | ||
if: always() | ||
uses: ./.github/workflows/slack-notifications.yml | ||
needs: | ||
- staticcheck | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notify slack -- workflow succeeded | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"actor": "${{ github.actor }}", | ||
"repo": "${{ github.repository }}", | ||
"status": "SUCCESS", | ||
"title": "push to master ✅", | ||
"pr": "" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }} | ||
- staticcheck | ||
secrets: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
status: ${{ needs.staticcheck.result }}${{ needs.test.result }} | ||
actor: ${{ github.actor }} | ||
repository: ${{ github.repository }} | ||
branch: "master" | ||
run_id: ${{ github.run_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# .github/workflows/slack-notifications.yml | ||
name: Slack Notifications | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
SLACK_BOT_TOKEN: | ||
required: true | ||
inputs: | ||
status: | ||
description: 'The status of the workflow (successsuccess or failure)' | ||
required: true | ||
type: string | ||
actor: | ||
description: 'The GitHub actor' | ||
required: true | ||
type: string | ||
repository: | ||
description: 'The GitHub repository' | ||
required: true | ||
type: string | ||
branch: | ||
description: 'The branch name' | ||
required: true | ||
type: string | ||
run_id: | ||
description: 'The workflow run ID' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
notify_slack: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Post to Slack | ||
run: | | ||
if [ "${{ inputs.status }}" == "successsuccess" ]; then | ||
payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{ | ||
"channel": "team-gnark-build", | ||
"text": "GitHub Action build result: success", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":large_green_circle: *All checks have passed:* *\($branch)* :white_check_mark:" | ||
}, | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "\($repository) -- \($actor) -- <https://github.com/\($repository)/actions/runs/\($run_id)|View details>" | ||
} | ||
] | ||
} | ||
] | ||
}') | ||
else | ||
payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{ | ||
"channel": "team-gnark-build", | ||
"text": "GitHub Action build result: failure", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":red_circle: *Failed run:* *\($branch)*" | ||
}, | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "\($repository) -- \($actor) -- <https://github.com/\($repository)/actions/runs/\($run_id)|View details>" | ||
} | ||
] | ||
} | ||
] | ||
}') | ||
fi | ||
response=$(curl -s -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" ) | ||
shell: bash |
Oops, something went wrong.