build: modify workflows for new CI slack bot (#1277) #461
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
on: | |
push: | |
branches: | |
- 'master' | |
name: push_master | |
jobs: | |
staticcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install Go | |
uses: actions/setup-go@v5 | |
with: | |
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 | |
- name: gofmt | |
run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi | |
- name: generated files should not be modified | |
run: | | |
go generate ./... | |
git update-index --assume-unchanged go.mod | |
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@v6 | |
with: | |
version: v1.60 | |
args: -v --timeout=5m | |
test: | |
strategy: | |
matrix: | |
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@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/[email protected] | |
- name: install solc deps | |
if: startsWith(matrix.os, 'ubuntu') == true | |
run: | | |
go install github.com/consensys/[email protected] | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install solc | |
- name: Test (windows / mac) | |
# on macOS CI / Windows CI we avoid running the std/ tests (they are run on ubuntu CI) | |
if: startsWith(matrix.os, 'ubuntu') == false | |
run: | | |
go test -tags=release_checks -v -timeout=60m . | |
- name: Test (ubuntu - race and solc) | |
if: startsWith(matrix.os, 'ubuntu') == true | |
run: | | |
go test -v -p 4 -short -timeout=30m ./... | |
go test -v -p 4 -timeout=120m -tags=release_checks ./std/math/emulated/... | |
go test -v -p 4 -timeout=120m -tags=release_checks ./std/lookup/... | |
go test -v -p 4 -tags=release_checks,solccheck . | |
go test -v -p 4 -timeout=50m -tags=release_checks -race ./examples/cubic/... | |
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-notifications: | |
if: always() | |
uses: ./.github/workflows/slack-notifications.yml | |
needs: | |
- test | |
- 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 }} |