Skip to content

Commit 00c10cf

Browse files
authored
feat: release-branch automation (#137)
## Why this should be merged Closes #25 ## How this works See #126. The code is in a new module to (a) avoid polluting the root `go.mod` file and (b) because `go-git` requires a newer version of Go. Unfortunately `go-git` doesn't support cherry-picking yet so a Bash script had to be used for that bit `#!/sad`. ## How this was tested Inspection of output when running `cherrypick.sh` (with `set -x` added) from the current branch. ``` ... ... + CHERRY_PICKS='2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 99bbbc0 1e9bf2a 69f815f e4b8058 34b46a2 159fb1a da71839' ... Skipping 2bd6bd0 already in history ... Cherry-picking 99bbbc0 ... Cherry-picking 1e9bf2a ... Cherry-picking 69f815f ... Cherry-picking e4b8058 ... Cherry-picking 34b46a2 ... Cherry-picking 159fb1a ... Cherry-picking da71839 ... + git cherry-pick 99bbbc0 1e9bf2a 69f815f e4b8058 34b46a2 159fb1a da71839 ```
1 parent 3ab3cd2 commit 00c10cf

File tree

7 files changed

+373
-2
lines changed

7 files changed

+373
-2
lines changed

.github/workflows/go.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ jobs:
3030
run: |
3131
go test -short $(go list ./... | grep -Pv "${FLAKY_REGEX}");
3232
33+
go_test_tooling:
34+
runs-on: ubuntu-latest
35+
defaults:
36+
run:
37+
working-directory: ./libevm/tooling
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0 # everything
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version-file: "./libevm/tooling/go.mod"
46+
- run: go test ./...
47+
3348
go_generate:
3449
env:
3550
EXCLUDE_REGEX: "ava-labs/libevm/(accounts/usbwallet/trezor)$"
@@ -47,13 +62,27 @@ jobs:
4762
- name: git diff
4863
run: git diff --exit-code
4964

50-
go_tidy:
65+
go_tidy_matrix:
5166
runs-on: ubuntu-latest
67+
strategy:
68+
matrix:
69+
dir: ["./", "./libevm/tooling"]
70+
defaults:
71+
run:
72+
working-directory: ${{ matrix.dir }}
5273
steps:
5374
- uses: actions/checkout@v4
5475
- name: Set up Go
5576
uses: actions/setup-go@v5
5677
with:
57-
go-version-file: "go.mod"
78+
go-version-file: "${{ matrix.dir }}/go.mod"
5879
- run: go mod tidy
5980
- run: git diff --exit-code
81+
82+
go_tidy:
83+
# Each matrix instance runs as a different name, which doesn't play nicely
84+
# with branch-protection rules. We instead require this job.
85+
needs: go_tidy_matrix
86+
runs-on: ubuntu-latest
87+
steps:
88+
- run: echo "I'm a no-op"

.github/workflows/shellcheck.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: shellcheck
2+
3+
on:
4+
push:
5+
branches: [main, "release/**"]
6+
pull_request:
7+
branches: [main, "release/**"]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
13+
14+
jobs:
15+
shellcheck:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Run ShellCheck
20+
uses: ludeeus/[email protected]
21+
with:
22+
scandir: './libevm'

libevm/tooling/go.mod

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module github.com/ava-labs/libevm/libevm/tooling
2+
3+
go 1.23
4+
5+
require (
6+
github.com/go-git/go-git/v5 v5.13.2
7+
github.com/google/go-cmp v0.6.0
8+
github.com/stretchr/testify v1.10.0
9+
)
10+
11+
require (
12+
dario.cat/mergo v1.0.0 // indirect
13+
github.com/Microsoft/go-winio v0.6.1 // indirect
14+
github.com/ProtonMail/go-crypto v1.1.5 // indirect
15+
github.com/cloudflare/circl v1.3.7 // indirect
16+
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
17+
github.com/davecgh/go-spew v1.1.1 // indirect
18+
github.com/emirpasic/gods v1.18.1 // indirect
19+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
20+
github.com/go-git/go-billy/v5 v5.6.2 // indirect
21+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
22+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
23+
github.com/kevinburke/ssh_config v1.2.0 // indirect
24+
github.com/pjbgf/sha1cd v0.3.2 // indirect
25+
github.com/pmezard/go-difflib v1.0.0 // indirect
26+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
27+
github.com/skeema/knownhosts v1.3.0 // indirect
28+
github.com/xanzy/ssh-agent v0.3.3 // indirect
29+
golang.org/x/crypto v0.32.0 // indirect
30+
golang.org/x/mod v0.17.0 // indirect
31+
golang.org/x/net v0.34.0 // indirect
32+
golang.org/x/sync v0.10.0 // indirect
33+
golang.org/x/sys v0.29.0 // indirect
34+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
35+
gopkg.in/warnings.v0 v0.1.2 // indirect
36+
gopkg.in/yaml.v3 v3.0.1 // indirect
37+
)

libevm/tooling/go.sum

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
2+
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
3+
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
4+
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
5+
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
6+
github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4=
7+
github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
8+
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
9+
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
10+
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
11+
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
12+
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
13+
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
14+
github.com/cyphar/filepath-securejoin v0.3.6 h1:4d9N5ykBnSp5Xn2JkhocYDkOpURL/18CYMpo6xB9uWM=
15+
github.com/cyphar/filepath-securejoin v0.3.6/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
16+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
17+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
18+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
19+
github.com/elazarl/goproxy v1.4.0 h1:4GyuSbFa+s26+3rmYNSuUVsx+HgPrV1bk1jXI0l9wjM=
20+
github.com/elazarl/goproxy v1.4.0/go.mod h1:X/5W/t+gzDyLfHW4DrMdpjqYjpXsURlBt9lpBDxZZZQ=
21+
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
22+
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
23+
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
24+
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
25+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
26+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
27+
github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM=
28+
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
29+
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
30+
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
31+
github.com/go-git/go-git/v5 v5.13.2 h1:7O7xvsK7K+rZPKW6AQR1YyNhfywkv7B8/FsP3ki6Zv0=
32+
github.com/go-git/go-git/v5 v5.13.2/go.mod h1:hWdW5P4YZRjmpGHwRH2v3zkWcNl6HeXaXQEMGb3NJ9A=
33+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
34+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
35+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
36+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
37+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
38+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
39+
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
40+
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
41+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
42+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
43+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
44+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
45+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
46+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
47+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
48+
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
49+
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
50+
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=
51+
github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A=
52+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
53+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
54+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
55+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
56+
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
57+
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
58+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
59+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
60+
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
61+
github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY=
62+
github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M=
63+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
64+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
65+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
66+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
67+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
68+
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
69+
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
70+
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
71+
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
72+
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
73+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
74+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
75+
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
76+
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
77+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
78+
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
79+
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
80+
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
81+
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
82+
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
83+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
84+
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
85+
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
86+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
87+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
88+
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
89+
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
90+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
91+
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
92+
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
93+
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
94+
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
95+
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
96+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
97+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
98+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
99+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
100+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
101+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
102+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
103+
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
104+
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
105+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
106+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
107+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
108+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

libevm/tooling/release/cherrypick.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2025 the libevm authors.
4+
#
5+
# The libevm additions to go-ethereum are free software: you can redistribute
6+
# them and/or modify them under the terms of the GNU Lesser General Public License
7+
# as published by the Free Software Foundation, either version 3 of the License,
8+
# or (at your option) any later version.
9+
#
10+
# The libevm additions are distributed in the hope that they will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with the go-ethereum library. If not, see
17+
# <http://www.gnu.org/licenses/>.
18+
19+
# Usage: run `./cherrypick.sh` on a branch intended to become a release.
20+
#
21+
# Reads the contents of ./cherrypicks, filters out commits that are already
22+
# ancestors of HEAD, and calls `git cherry-pick` with the remaining commit
23+
# hashes.
24+
25+
set -eu;
26+
set -o pipefail;
27+
28+
SELF_DIR=$(dirname "${0}")
29+
# The format of the `cherrypicks` file is guaranteed by a test so we can use simple parsing here.
30+
CHERRY_PICKS=$(< "${SELF_DIR}/cherrypicks" grep -Pv "^#" | awk '{print $1}')
31+
32+
commits=()
33+
for commit in ${CHERRY_PICKS}; do
34+
git merge-base --is-ancestor "${commit}" HEAD && \
35+
echo "Skipping ${commit} already in history" && \
36+
continue;
37+
38+
echo "Cherry-picking ${commit}";
39+
commits+=("${commit}");
40+
done
41+
42+
if [[ -z "${commits[*]// }" ]]; then # $x// removes whitespace
43+
echo "No commits to cherry-pick";
44+
exit 0;
45+
fi
46+
47+
git cherry-pick "${commits[@]}";

libevm/tooling/release/cherrypicks

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Lines starting with # are ignored as comments.
2+
# All other lines MUST have the format [<commit> # <first line of commit message>].
3+
# Commits MUST be in chronological order.
4+
# A test in release_test.go will enforce this / provide the correct lines to copy and paste.
5+
#
6+
# The very first commit is where libevm branched off geth and is included to confirm that it is skipped.
7+
#
8+
2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # Merge branch 'master' into release/1.13
9+
99bbbc0277e34fc3a31512a345ba20874ae98e18 # internal/build, rpc: add missing HTTP response body Close() calls (#29223)
10+
1e9bf2a09ed3d82ac1aa69750a556f3ce127721d # core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563)
11+
69f815f6f5791e0e48160bdad284773d0ffb1ba9 # params: print time value instead of pointer in ConfigCompatError (#29514)
12+
e4b8058d5a5832cdebdac7da385cf6d829c0d433 # eth/gasprice: add query limit for FeeHistory to defend DDOS attack (#29644)
13+
34b46a2f756da71595ac84eb7f25441f2a5b6ebb # core/state/snapshot: add a missing lock (#30001)
14+
159fb1a1db551c544978dc16a5568a4730b4abf3 # crypto: add IsOnCurve check (#31100)
15+
da71839a270a353bac92e3108e4b74fb0eefec29 # internal/ethapi: fix panic in debug methods (#31157)
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Copyright 2025 the libevm authors.
2+
//
3+
// The libevm additions to go-ethereum are free software: you can redistribute
4+
// them and/or modify them under the terms of the GNU Lesser General Public License
5+
// as published by the Free Software Foundation, either version 3 of the License,
6+
// or (at your option) any later version.
7+
//
8+
// The libevm additions are distributed in the hope that they will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
11+
// General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU Lesser General Public License
14+
// along with the go-ethereum library. If not, see
15+
// <http://www.gnu.org/licenses/>.
16+
17+
package release
18+
19+
import (
20+
"errors"
21+
"fmt"
22+
"regexp"
23+
"sort"
24+
"strings"
25+
"testing"
26+
27+
"github.com/go-git/go-git/v5"
28+
"github.com/go-git/go-git/v5/plumbing"
29+
"github.com/go-git/go-git/v5/plumbing/object"
30+
"github.com/google/go-cmp/cmp"
31+
"github.com/stretchr/testify/require"
32+
33+
_ "embed"
34+
)
35+
36+
var (
37+
//go:embed cherrypicks
38+
cherryPicks string
39+
lineFormatRE = regexp.MustCompile(`^([a-fA-F0-9]{40}) # (.*)$`)
40+
)
41+
42+
func TestCherryPicksFormat(t *testing.T) {
43+
type parsedLine struct {
44+
hash, commitMsg string
45+
}
46+
var (
47+
rawLines []string
48+
lines []parsedLine
49+
)
50+
51+
for i, line := range strings.Split(cherryPicks, "\n") {
52+
if line == "" || strings.HasPrefix(line, "#") {
53+
continue
54+
}
55+
56+
switch matches := lineFormatRE.FindStringSubmatch(line); len(matches) {
57+
case 3:
58+
rawLines = append(rawLines, line)
59+
lines = append(lines, parsedLine{
60+
hash: matches[1],
61+
commitMsg: matches[2],
62+
})
63+
64+
default:
65+
t.Errorf("Line %d is improperly formatted: %s", i, line)
66+
}
67+
}
68+
if t.Failed() {
69+
t.Fatalf("Required line regexp: %s", lineFormatRE.String())
70+
}
71+
72+
opts := &git.PlainOpenOptions{DetectDotGit: true}
73+
repo, err := git.PlainOpenWithOptions("./", opts)
74+
require.NoErrorf(t, err, "git.PlainOpenWithOptions(./, %+v", opts)
75+
76+
fetch := &git.FetchOptions{
77+
RemoteURL: "https://github.com/ethereum/go-ethereum.git",
78+
}
79+
err = repo.Fetch(fetch)
80+
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
81+
t.Fatalf("%T.Fetch(%+v) error %v", repo, fetch, err)
82+
}
83+
84+
commits := make([]struct {
85+
obj *object.Commit
86+
line parsedLine
87+
}, len(lines))
88+
89+
for i, line := range lines {
90+
obj, err := repo.CommitObject(plumbing.NewHash(line.hash))
91+
require.NoErrorf(t, err, "%T.CommitObject(%q)", repo, line.hash)
92+
93+
commits[i].obj = obj
94+
commits[i].line = line
95+
}
96+
sort.Slice(commits, func(i, j int) bool {
97+
ci, cj := commits[i].obj, commits[j].obj
98+
return ci.Committer.When.Before(cj.Committer.When)
99+
})
100+
101+
var want []string
102+
for _, c := range commits {
103+
msg := strings.Split(c.obj.Message, "\n")[0]
104+
want = append(
105+
want,
106+
fmt.Sprintf("%s # %s", c.line.hash, msg),
107+
)
108+
}
109+
if diff := cmp.Diff(want, rawLines); diff != "" {
110+
t.Errorf("Commits in `cherrypicks` file out of order or have incorrect commit message(s);\n(-want +got):\n%s", diff)
111+
t.Logf("To fix, copy:\n%s", strings.Join(want, "\n"))
112+
}
113+
}

0 commit comments

Comments
 (0)