chore: update contract bytecodes #1231
Workflow file for this run
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
name: ci | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: [main] | |
concurrency: | |
group: ci-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GO_VERSION: "1.22" # https://go.dev/dl/ | |
STRINGER_VERSION: "0.27.0" # https://pkg.go.dev/golang.org/x/tools/cmd/stringer?tab=versions | |
# Protoc dependencies. | |
PROTOC_VERSION: "28.3" # https://github.com/protocolbuffers/protobuf/releases | |
PROTOC_GEN_GO_VERSION: "1.35.2" # https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go?tab=versions | |
PROTOC_GEN_GO_GRPC_VERSION: "1.5.1" # https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc?tab=versions | |
ARCH: "linux-x86_64" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install golangci-lint | |
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | |
- name: Install shadow | |
run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest | |
- name: Run all the linter tools against code | |
run: make lint | |
gen: | |
name: Check generated files | |
runs-on: ubuntu-latest | |
steps: | |
# Dependencies to generate doc, protobuf stubs and go bindings. | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# Dependencies to generate protobuf stubs. | |
- name: Install protoc | |
run: | | |
wget https://github.com/protocolbuffers/protobuf/releases/download/v${{ env.PROTOC_VERSION }}/protoc-${{ env.PROTOC_VERSION }}-${{ env.ARCH }}.zip | |
unzip protoc-${{ env.PROTOC_VERSION }}-${{ env.ARCH }}.zip | |
rm protoc-${{ env.PROTOC_VERSION }}-${{ env.ARCH }}.zip | |
rm readme.txt | |
sudo mv bin/protoc /usr/local/bin/ | |
sudo mv include/google /usr/local/include | |
protoc --version | |
- name: Install protoc plugins for go | |
run: | | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v${{ env.PROTOC_GEN_GO_VERSION }} | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${{ env.PROTOC_GEN_GO_GRPC_VERSION }} | |
protoc-gen-go --version | |
protoc-gen-go-grpc --version | |
# Dependencies to generate go bindings. | |
- name: Install abigen | |
run: | | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
abigen --version | |
- name: Install foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Get forge version | |
run: forge --version | |
- name: Install contract dependencies | |
working-directory: contracts | |
run: forge install | |
# Dependencies to generate loadtest modes strings. | |
- name: Install stringer | |
run: go install golang.org/x/tools/cmd/stringer@v${{ env.STRINGER_VERSION }} | |
- name: Try to update generated files | |
run: make gen | |
- name: Check if generated files are up to date | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "❌ Error: Generated files are not up to date. Please run \`make gen\`." | |
echo "🚨 If \`make gen\` doesn't update the contract bytecodes and/or go bindings and this job is still failing, please take a look at the ethereum and foundry versions. We don't pin the versions of these packages in CI so this job may complain after an update of the packages!" | |
git status --porcelain | |
git diff | |
exit 1 | |
else | |
echo "✅ Generated files are up to date." | |
fi | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run tests | |
run: make test | |
loadtest: | |
name: Run loadtest | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tool: [geth, anvil] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
# foundry only has nightly versions no we don't specify a version at the moment. | |
- name: Install Geth | |
run: | | |
if [ "${{ matrix.tool }}" = "geth" ]; then | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
geth --version | |
fi | |
- name: Run loadtest againt ${{ matrix.tool }} | |
run: | | |
${{ matrix.tool }} --version | |
make ${{ matrix.tool }} & | |
sleep 5 | |
make loadtest | |
install: | |
name: Install go package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install dependencies | |
run: go get | |
- name: Install polycli using go | |
run: go install | |
- name: Check that polycli has been installed | |
run: polygon-cli version |