github.com/consensys/gnark-crypto@v0.14.0/.github/workflows/push.yml (about) 1 on: 2 push: 3 branches: 4 - 'master' 5 name: push_master 6 jobs: 7 staticcheck: 8 runs-on: ubuntu-latest 9 steps: 10 - name: checkout code 11 uses: actions/checkout@v4 12 with: 13 fetch-depth: 0 14 - name: install Go 15 uses: actions/setup-go@v5 16 with: 17 go-version: 1.23.x 18 19 - name: install deps 20 run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest 21 - name: gofmt 22 run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi 23 - name: generated files should not be modified 24 run: | 25 go generate ./... 26 git update-index --assume-unchanged go.mod 27 git update-index --assume-unchanged go.sum 28 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 29 30 # hack to ensure golanglint process generated files 31 - name: remove "generated by" comments from generated files 32 run: | 33 find . -type f -name '*.go' -exec sed -i 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; 34 # on macos: find . -type f -name '*.go' -exec sed -i '' -E 's/Code generated by .* DO NOT EDIT/FOO/g' {} \; 35 - name: golangci-lint 36 uses: golangci/golangci-lint-action@v6 37 with: 38 version: v1.60 39 args: -v --timeout=5m 40 41 test: 42 strategy: 43 matrix: 44 go-version: [1.23.x] 45 os: [ubuntu-latest-128, windows-latest, macos-latest] 46 runs-on: ${{ matrix.os }} 47 needs: 48 - staticcheck 49 outputs: 50 failures: ${{ steps.generate-job-summary.outputs.failures }} 51 steps: 52 - name: checkout code 53 uses: actions/checkout@v4 54 - name: install Go 55 uses: actions/setup-go@v5 56 with: 57 go-version: ${{ matrix.go-version }} 58 59 - name: install deps 60 run: | 61 go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest 62 # Install gotestfmt on the VM running the action. 63 - name: Set up gotestfmt 64 uses: gotesttools/gotestfmt-action@v2 65 with: 66 # Optional: pass GITHUB_TOKEN to avoid rate limiting. 67 token: ${{ secrets.GITHUB_TOKEN }} 68 - name: Test (windows / mac) 69 # on macOS CI / Windows CI we avoid running the std/ tests (they are run on ubuntu CI) 70 if: startsWith(matrix.os, 'ubuntu') == false 71 run: | 72 go test -short -v -timeout=60m ./... 73 - name: Test (ubuntu - race and solc) 74 if: startsWith(matrix.os, 'ubuntu') == true 75 run: | 76 set -euo pipefail 77 go test -json -v -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log 78 go test -json -v -tags=purego -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log 79 go test -json -v -race -timeout=30m ./ecc/bn254/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log 80 GOARCH=386 go test -json -short -v -timeout=30m ./ecc/bn254/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log 81 82 - name: Generate job summary 83 id: generate-job-summary 84 if: startsWith(matrix.os, 'ubuntu') == true && always() 85 run: | 86 if [ -s /tmp/gotest.log ]; then 87 cat /tmp/gotest.log > $GITHUB_STEP_SUMMARY 88 echo "failures=$(cat /tmp/gotest.log | node .github/parse-tests.js)" > $GITHUB_OUTPUT 89 else 90 echo "## Success ✅" > $GITHUB_STEP_SUMMARY 91 echo "failures=" > $GITHUB_OUTPUT 92 fi 93 94 slack-workflow-status-failed: 95 if: failure() 96 name: post workflow status to slack 97 needs: 98 - staticcheck 99 - test 100 runs-on: ubuntu-latest 101 steps: 102 - name: Notify slack -- workflow failed 103 id: slack 104 uses: slackapi/slack-github-action@v1.26.0 105 with: 106 payload: | 107 { 108 "actor": "${{ github.actor }}", 109 "repo": "${{ github.repository }}", 110 "status": "FAIL", 111 "title": "push to master ⚠", 112 "pr": "", 113 "failed_step_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/", 114 "message": "${{ needs.test.outputs.failures }}" 115 } 116 env: 117 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 118 119 slack-workflow-status-success: 120 if: success() 121 name: post workflow status to slack 122 needs: 123 - staticcheck 124 - test 125 runs-on: ubuntu-latest 126 steps: 127 - name: Notify slack -- workflow succeeded 128 id: slack 129 uses: slackapi/slack-github-action@v1.26.0 130 with: 131 payload: | 132 { 133 "actor": "${{ github.actor }}", 134 "repo": "${{ github.repository }}", 135 "status": "SUCCESS", 136 "title": "push to master ✅", 137 "pr": "" 138 } 139 env: 140 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }}