11name : Rename Go module
22
33on :
4- pull_request : # DO NOT MERGE WITH ANYTHING OTHER THAN workflow_dispatch
5- branches : [ main ]
4+ # During development, the next two lines MAY be enabled to have the PR
5+ # automatically run this workflow for inspection of the resulting branch.
6+ # However, they MUST be disabled again before merging otherwise *all* PRs will
7+ # run this.
8+ #
9+ # pull_request:
10+ # branches: [ main ]
611 workflow_dispatch :
712 inputs :
813 source_commit :
914 description : ' Upstream commit on which to base module renaming'
1015 required : true
1116 type : string
12- default : ' '
17+ default : ' 2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 '
1318
1419jobs :
1520 rename-module :
2429 fetch-depth : 0 # everything
2530 fetch-tags : true
2631
27- - name : Check out source commit `{{ $env.source_commit }}`
32+ - name : Check out source commit
2833 run : git checkout ${{ env.source_commit }}
2934
3035 - name : Globally update module name
@@ -45,17 +50,17 @@ jobs:
4550 go-version : 1.21.4
4651
4752 - name : Smoke tests
48- # `go list` shows us the module name
53+ # `go list` shows us the module name and grep will non-zero exit on mismatch
4954 # `go build` is a rudimentary but broad test of correctness
5055 # The explicitly tested packages are edge cases:
51- # - bind creates generates tests and a go.mod on the fly
56+ # - bind generates tests and a go.mod on the fly
5257 # - rlpgen has testdata with imports that need updating
5358 run : |
5459 go list . | grep ava-labs/libevm;
5560 go build ./...;
5661 go test ./accounts/abi/bind ./rlp/rlpgen
5762
58- - name : Commit to ${{ env.output_branch }} branch
63+ - name : Commit to new branch
5964 uses : devops-infra/action-commit-push@8bc2ff9f9de7aa2a7581fc7e5b6401c04cab54c7
6065 with :
6166 github_token : ${{ secrets.GITHUB_TOKEN }}
6469 commit_prefix : " [AUTO] rename Go module + update internal import paths"
6570
6671 - name : Open PR to "renamed-go-module" iff workflow dispatched on "main"
67- if : github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
72+ # If we are changing the way in which we manage module renaming then it
73+ # MUST go through PR review to main; only then can it open PRs.
74+ # if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
6875 uses :
devops-infra/[email protected] 6976 with :
7077 github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments