mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-21 14:14:30 +00:00
## Why this should be merged Introduction of breaking upstream changes (inclusion of `.go.tpl` files) since the workflow was written. Resulted in [failed smoke tests](https://github.com/ava-labs/libevm/actions/runs/13198798601) due to ABI-binding templates not being updated. ## How this works Only (1) is necessary for the fix but the others were added for convenience as relevant to this PR: 1. Replace module name in `*.go.tpl` files; 2. As above for `*.proto` files (`go_package` option); 3. Remove concurrency limitations as they're unnecessary with a manually triggered workflow; and 4. Display all tags that point to the source commit as they're useful for inspection of version. ## How this was tested [Successful workflow run](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786) at upstream v1.15.0. For the modifications, respectively: 1. Smoke tests pass and no `.go.tpl` files in [Remnant references](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786#step:9:1); 2. As above re remnant references; 3. N/A; and 4. Inspection of [step output](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786#step:6:5).
87 lines
3.1 KiB
YAML
87 lines
3.1 KiB
YAML
name: Rename Go module
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
source_commit:
|
|
description: "Upstream commit on which to base module renaming"
|
|
required: true
|
|
type: string
|
|
default: "2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1"
|
|
|
|
jobs:
|
|
rename-module:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # everything
|
|
|
|
- name: Set variables
|
|
id: vars
|
|
# Including hashes of both the source commit and the workflow file makes
|
|
# this idempotent.
|
|
env:
|
|
WORKFLOW_HASH: ${{ hashFiles('.github/workflows/rename-module.yml') }}
|
|
run: |
|
|
echo "WORKFLOW_HASH=${WORKFLOW_HASH}" >> "$GITHUB_OUTPUT";
|
|
echo "DEST_BRANCH=auto-rename-module_source-${{ inputs.source_commit }}_workflow-${WORKFLOW_HASH}-${{ github.ref_name }}" \
|
|
>> "$GITHUB_OUTPUT";
|
|
|
|
- name: Fetch tags from ethereum/go-ethereum
|
|
run: git fetch --tags https://github.com/ethereum/go-ethereum.git
|
|
|
|
- name: Tags pointing to source commit
|
|
run: git tag --points-at ${{ inputs.source_commit }}
|
|
|
|
- name: Check out source commit
|
|
run: git checkout ${{ inputs.source_commit }}
|
|
|
|
- name: Globally update module name
|
|
run: |
|
|
go mod edit -module github.com/ava-labs/libevm;
|
|
find . \
|
|
-iname '*.go' \
|
|
-o -iname '*.txt' \
|
|
-o -iname '*.go.tpl' \
|
|
-o -iname '*.proto' | xargs \
|
|
sed -i -E 's|(["`]github\.com/)ethereum/go-ethereum|\1ava-labs/libevm|g';
|
|
|
|
- name: Remnant references
|
|
run: |
|
|
find . -type f | \
|
|
xargs grep -In github.com/ethereum/go-ethereum | \
|
|
grep -v "https://github.com/ethereum/go-ethereum"
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: "go.mod"
|
|
|
|
- name: Smoke tests
|
|
# `go list` shows us the module name and grep will non-zero exit on mismatch
|
|
# `go build` is a rudimentary but broad test of correctness
|
|
# The explicitly tested packages are edge cases:
|
|
# - bind generates tests and a go.mod on the fly
|
|
# - rlpgen has testdata with imports that need updating
|
|
run: |
|
|
go list . | grep ava-labs/libevm;
|
|
go build ./...;
|
|
go test ./accounts/abi/bind ./rlp/rlpgen
|
|
|
|
- name: Create new branch
|
|
env:
|
|
BRANCH: ${{ steps.vars.outputs.DEST_BRANCH }}
|
|
run: |
|
|
git checkout -b "${BRANCH}";
|
|
git push origin "${BRANCH}";
|
|
|
|
- name: Commit to new branch
|
|
uses: planetscale/ghcommit-action@d4176bfacef926cc2db351eab20398dfc2f593b5 # v0.2.0
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
with:
|
|
# WARNING: mirror any change to the commit_message value below in libevm-delta.yml
|
|
commit_message: "[AUTO] rename Go module + update internal import paths\n\nWorkflow: ${{ steps.vars.outputs.WORKFLOW_HASH }} on branch ${{ github.ref_name }}"
|
|
repo: ${{ github.repository }}
|
|
branch: ${{ steps.vars.outputs.DEST_BRANCH }}
|