chore: replace strings.HasPrefix combined with strings.TrimPrefix by strings.CutPrefix
#2552
Workflow file for this run
This file contains hidden or 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] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
| env: | |
| GO_VERSION: "1.24.1" # https://go.dev/dl/ | |
| FOUNDRY_VERSION: stable | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| 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 v1.64.8 | |
| - name: Install shadow | |
| run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/[email protected] | |
| - name: Run all the linter tools against code | |
| run: make lint | |
| typos: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06 # v1.40.0 | |
| gen-doc: | |
| name: Check gen-doc generated files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: gen-doc | |
| run: make gen-doc | |
| - 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 | |
| gen-proto: | |
| name: Check gen-proto generated files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: gen-proto | |
| run: make gen-proto | |
| - 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 | |
| gen-go-bindings: | |
| name: Check gen-go-bindings generated files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: init submodules | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| - name: gen-go-bindings | |
| run: make gen-go-bindings | |
| - 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 | |
| gen-load-test-modes: | |
| name: Check gen-load-test-modes generated files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: gen-load-test-modes | |
| run: make gen-load-test-modes | |
| - 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 | |
| gen-json-rpc-types: | |
| name: Check gen-json-rpc-types generated files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: gen-json-rpc-types | |
| run: make gen-json-rpc-types | |
| - 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@v6 | |
| - uses: actions/setup-go@v6 | |
| 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@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0 | |
| with: | |
| version: ${{ env.FOUNDRY_VERSION }} | |
| - 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@v6 | |
| - uses: actions/setup-go@v6 | |
| 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 |