From 0b15657d36ba04d62bbcb10ad3b4e1cd19edb075 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 16:13:01 +0000 Subject: [PATCH 01/21] feat: automated cherry-picking for releases --- libevm/tooling/go.mod | 36 +++++++++ libevm/tooling/go.sum | 108 +++++++++++++++++++++++++ libevm/tooling/release/cherrypick.sh | 21 +++++ libevm/tooling/release/cherrypicks | 5 ++ libevm/tooling/release/release_test.go | 76 +++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 libevm/tooling/go.mod create mode 100644 libevm/tooling/go.sum create mode 100755 libevm/tooling/release/cherrypick.sh create mode 100644 libevm/tooling/release/cherrypicks create mode 100644 libevm/tooling/release/release_test.go diff --git a/libevm/tooling/go.mod b/libevm/tooling/go.mod new file mode 100644 index 00000000000..e3738b5c156 --- /dev/null +++ b/libevm/tooling/go.mod @@ -0,0 +1,36 @@ +module github.com/ava-labs/libevm/libevm/tooling + +go 1.23 + +require ( + github.com/go-git/go-git/v5 v5.13.2 + github.com/stretchr/testify v1.10.0 +) + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/ProtonMail/go-crypto v1.1.5 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/cyphar/filepath-securejoin v0.3.6 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.6.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/pjbgf/sha1cd v0.3.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/skeema/knownhosts v1.3.0 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/libevm/tooling/go.sum b/libevm/tooling/go.sum new file mode 100644 index 00000000000..e4eba040730 --- /dev/null +++ b/libevm/tooling/go.sum @@ -0,0 +1,108 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4= +github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cyphar/filepath-securejoin v0.3.6 h1:4d9N5ykBnSp5Xn2JkhocYDkOpURL/18CYMpo6xB9uWM= +github.com/cyphar/filepath-securejoin v0.3.6/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/elazarl/goproxy v1.4.0 h1:4GyuSbFa+s26+3rmYNSuUVsx+HgPrV1bk1jXI0l9wjM= +github.com/elazarl/goproxy v1.4.0/go.mod h1:X/5W/t+gzDyLfHW4DrMdpjqYjpXsURlBt9lpBDxZZZQ= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= +github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= +github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.13.2 h1:7O7xvsK7K+rZPKW6AQR1YyNhfywkv7B8/FsP3ki6Zv0= +github.com/go-git/go-git/v5 v5.13.2/go.mod h1:hWdW5P4YZRjmpGHwRH2v3zkWcNl6HeXaXQEMGb3NJ9A= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= +github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/libevm/tooling/release/cherrypick.sh b/libevm/tooling/release/cherrypick.sh new file mode 100755 index 00000000000..201673fd635 --- /dev/null +++ b/libevm/tooling/release/cherrypick.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -eu; +set -o pipefail; + +SELF_DIR=$(dirname $0) +# The format of the `cherrypicks` file is guaranteed by a test so we can use simple parsing here. +CHERRY_PICKS=$(cat "${SELF_DIR}/cherrypicks" | grep -Pv "^#" | awk '{print $1}') +RELEASE_REF="main"; + +commits=() +for commit in ${CHERRY_PICKS}; do + git merge-base --is-ancestor "${commit}" "${RELEASE_REF}" && \ + echo "Skipping ${commit} already in history" && \ + continue; + + echo "Cherry-picking ${commit}"; + commits+=("${commit}"); +done + +git cherry-pick "${commits[@]}"; \ No newline at end of file diff --git a/libevm/tooling/release/cherrypicks b/libevm/tooling/release/cherrypicks new file mode 100644 index 00000000000..b803ac1aa0a --- /dev/null +++ b/libevm/tooling/release/cherrypicks @@ -0,0 +1,5 @@ +# Lines starting with # are ignored as comments. +# All other lines MUST have the format [ # ]. +2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # libevm branch point, known to be in history, tests cherry-pick skipping +69f815f6f5791e0e48160bdad284773d0ffb1ba9 # print ConfigCompatError time +159fb1a1db551c544978dc16a5568a4730b4abf3 # S256.IsOnCurve() check \ No newline at end of file diff --git a/libevm/tooling/release/release_test.go b/libevm/tooling/release/release_test.go new file mode 100644 index 00000000000..8301829508b --- /dev/null +++ b/libevm/tooling/release/release_test.go @@ -0,0 +1,76 @@ +// Copyright 2025 the libevm authors. +// +// The libevm additions to go-ethereum are free software: you can redistribute +// them and/or modify them under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, either version 3 of the License, +// or (at your option) any later version. +// +// The libevm additions are distributed in the hope that they will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +// General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see +// . + +package release + +import ( + "regexp" + "strings" + "testing" + "time" + + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" + "github.com/stretchr/testify/require" + + _ "embed" +) + +var ( + //go:embed cherrypicks + cherryPicks string + lineFormatRE = regexp.MustCompile(`^([a-fA-F0-9]{40}) #.+$`) +) + +func TestCherryPicksFormat(t *testing.T) { + var commits []string + + for i, line := range strings.Split(cherryPicks, "\n") { + if strings.HasPrefix(line, "#") { + continue + } + + switch matches := lineFormatRE.FindStringSubmatch(line); len(matches) { + case 2: + commits = append(commits, matches[1]) + default: + t.Errorf("Line %d is improperly formatted: %s", i, line) + } + } + if t.Failed() { + t.Fatalf("Required line regexp: %s", lineFormatRE.String()) + } + + opts := &git.PlainOpenOptions{DetectDotGit: true} + repo, err := git.PlainOpenWithOptions("./", opts) + require.NoErrorf(t, err, "git.PlainOpenWithOptions(./, %+v", opts) + + var ( + lastHash string + lastAt time.Time + ) + for _, hash := range commits { + obj, err := repo.CommitObject(plumbing.NewHash(hash)) + require.NoErrorf(t, err, "%T.CommitObject(%q)", repo, hash) + + at := obj.Committer.When + if !at.After(lastAt) { + t.Errorf("Commit %s (%s) is not after %s (%s)", hash, at, lastHash, lastAt) + } + lastHash = hash + lastAt = at + } +} From 03d89a625043a346aa170e47a8a602d94f20b1e8 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 16:13:27 +0000 Subject: [PATCH 02/21] chore(ci): add tooling tests --- .github/workflows/go.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 221b0fb6ab2..441ab213f74 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,6 +30,19 @@ jobs: run: | go test -short $(go list ./... | grep -Pv "${FLAKY_REGEX}"); + go_test_tooling: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./libevm/tooling + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - run: go test ./... + go_generate: env: EXCLUDE_REGEX: "ava-labs/libevm/(accounts/usbwallet/trezor)$" From b7b8ea812dfb2d3223eba5bf695bb8438a7249d6 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 16:16:15 +0000 Subject: [PATCH 03/21] fix(ci): use tooling `go.mod` for version --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 441ab213f74..4f4d1f4ebc7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,7 +40,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: "go.mod" + go-version-file: "./libevm/tooling/go.mod" - run: go test ./... go_generate: From 329110e76f4bbac80aae3812fe8c75befa51b537 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 16:19:12 +0000 Subject: [PATCH 04/21] fix(ci): fetch entire repo for running cherry-pick tests --- .github/workflows/go.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4f4d1f4ebc7..f204e8f263c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -37,6 +37,8 @@ jobs: working-directory: ./libevm/tooling steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # everything - name: Set up Go uses: actions/setup-go@v5 with: From e874fefdbaee138f8996a4912871f8bb5cf2d70d Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 17:34:49 +0000 Subject: [PATCH 05/21] fix: explicitly fetch git before checking commits --- libevm/tooling/release/release_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libevm/tooling/release/release_test.go b/libevm/tooling/release/release_test.go index 8301829508b..87e96b52c2f 100644 --- a/libevm/tooling/release/release_test.go +++ b/libevm/tooling/release/release_test.go @@ -58,6 +58,12 @@ func TestCherryPicksFormat(t *testing.T) { repo, err := git.PlainOpenWithOptions("./", opts) require.NoErrorf(t, err, "git.PlainOpenWithOptions(./, %+v", opts) + fetch := &git.FetchOptions{ + RemoteURL: "https://github.com/ethereum/go-ethereum.git", + } + err = repo.Fetch(fetch) + require.NoErrorf(t, err, "%T.Fetch(%+v)", repo, fetch) + var ( lastHash string lastAt time.Time From 7c23aee21a8505c341e443b8cbe8a1997be42025 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 17:36:21 +0000 Subject: [PATCH 06/21] Revert "fix(ci): fetch entire repo for running cherry-pick tests" This reverts commit 329110e76f4bbac80aae3812fe8c75befa51b537. --- .github/workflows/go.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f204e8f263c..4f4d1f4ebc7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -37,8 +37,6 @@ jobs: working-directory: ./libevm/tooling steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # everything - name: Set up Go uses: actions/setup-go@v5 with: From 433b6731948d8c5bcb548d7edf3af9d1586a68d1 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 17:37:58 +0000 Subject: [PATCH 07/21] :facepalm: Revert "Revert "fix(ci): fetch entire repo for running cherry-pick tests"" This reverts commit 7c23aee21a8505c341e443b8cbe8a1997be42025. --- .github/workflows/go.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4f4d1f4ebc7..f204e8f263c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -37,6 +37,8 @@ jobs: working-directory: ./libevm/tooling steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # everything - name: Set up Go uses: actions/setup-go@v5 with: From 1aec095cc4652703e01f9ee7eafc4fd5bec3c537 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 17:47:29 +0000 Subject: [PATCH 08/21] refactor: allow empty lines in cherry-pick config --- libevm/tooling/release/cherrypick.sh | 2 +- libevm/tooling/release/cherrypicks | 2 +- libevm/tooling/release/release_test.go | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libevm/tooling/release/cherrypick.sh b/libevm/tooling/release/cherrypick.sh index 201673fd635..9897e576051 100755 --- a/libevm/tooling/release/cherrypick.sh +++ b/libevm/tooling/release/cherrypick.sh @@ -18,4 +18,4 @@ for commit in ${CHERRY_PICKS}; do commits+=("${commit}"); done -git cherry-pick "${commits[@]}"; \ No newline at end of file +git cherry-pick "${commits[@]}"; diff --git a/libevm/tooling/release/cherrypicks b/libevm/tooling/release/cherrypicks index b803ac1aa0a..27d850c37b7 100644 --- a/libevm/tooling/release/cherrypicks +++ b/libevm/tooling/release/cherrypicks @@ -2,4 +2,4 @@ # All other lines MUST have the format [ # ]. 2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # libevm branch point, known to be in history, tests cherry-pick skipping 69f815f6f5791e0e48160bdad284773d0ffb1ba9 # print ConfigCompatError time -159fb1a1db551c544978dc16a5568a4730b4abf3 # S256.IsOnCurve() check \ No newline at end of file +159fb1a1db551c544978dc16a5568a4730b4abf3 # S256.IsOnCurve() check diff --git a/libevm/tooling/release/release_test.go b/libevm/tooling/release/release_test.go index 87e96b52c2f..b7fd99b50c7 100644 --- a/libevm/tooling/release/release_test.go +++ b/libevm/tooling/release/release_test.go @@ -17,6 +17,7 @@ package release import ( + "errors" "regexp" "strings" "testing" @@ -39,7 +40,7 @@ func TestCherryPicksFormat(t *testing.T) { var commits []string for i, line := range strings.Split(cherryPicks, "\n") { - if strings.HasPrefix(line, "#") { + if line == "" || strings.HasPrefix(line, "#") { continue } @@ -62,7 +63,9 @@ func TestCherryPicksFormat(t *testing.T) { RemoteURL: "https://github.com/ethereum/go-ethereum.git", } err = repo.Fetch(fetch) - require.NoErrorf(t, err, "%T.Fetch(%+v)", repo, fetch) + if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) { + t.Fatalf("%T.Fetch(%+v) error %v", repo, fetch, err) + } var ( lastHash string From 3503a26ff84cc41d4f9659c71d64614b325b1b20 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 17:57:55 +0000 Subject: [PATCH 09/21] chore(ci): matrix strategy for `go_tidy` working dir --- .github/workflows/go.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f204e8f263c..840e3cb2318 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -64,11 +64,17 @@ jobs: go_tidy: runs-on: ubuntu-latest + strategy: + matrix: + dir: [".", "./libevm/tooling"] + defaults: + run: + working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: "go.mod" + go-version-file: "${{ matrix.dir }}/go.mod" - run: go mod tidy - run: git diff --exit-code From 38cd4e004569e9abbbc79fe179b3da477e097b4f Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 18:01:31 +0000 Subject: [PATCH 10/21] chore(ci): use `./` instead of `.` for readability --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 840e3cb2318..5c4250368e8 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -66,7 +66,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dir: [".", "./libevm/tooling"] + dir: ["./", "./libevm/tooling"] defaults: run: working-directory: ${{ matrix.dir }} From 80f0668bb0a859a91153f50a39a7ea40f2f9acff Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 18:06:36 +0000 Subject: [PATCH 11/21] chore(ci): GitHub workaround (hopefully) --- .github/workflows/go.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 5c4250368e8..33d3ad2cc66 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -62,7 +62,7 @@ jobs: - name: git diff run: git diff --exit-code - go_tidy: + go_tidy_matrix: runs-on: ubuntu-latest strategy: matrix: @@ -78,3 +78,8 @@ jobs: go-version-file: "${{ matrix.dir }}/go.mod" - run: go mod tidy - run: git diff --exit-code + + go_tidy: + # Each matrix instance runs as a different name, which doesn't play nicely + # with branch-protection rules. We instead require this job. + needs: go_tidy_matrix From 646f39ea402026f5e8ad52d8ed76fc5bebebc8d6 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 18:12:58 +0000 Subject: [PATCH 12/21] chore(ci): fight with GitHub Actions --- .github/workflows/go.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 33d3ad2cc66..2a1d6550b36 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -83,3 +83,6 @@ jobs: # Each matrix instance runs as a different name, which doesn't play nicely # with branch-protection rules. We instead require this job. needs: go_tidy_matrix + runs-on: ubuntu-latest + steps: + - run: echo "I'm a no-op" From 6e61742392061d0453ffc08a0f72f6f9a7f94cc2 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 18:16:07 +0000 Subject: [PATCH 13/21] chore: YAML linting --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2a1d6550b36..1a1d51fa28c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -85,4 +85,4 @@ jobs: needs: go_tidy_matrix runs-on: ubuntu-latest steps: - - run: echo "I'm a no-op" + - run: echo "I'm a no-op" From 78ef30c0264281693d43f1b6deeb4b78ac6cf841 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 19:49:06 +0000 Subject: [PATCH 14/21] chore: document `cherrypick.sh` and use `HEAD` instead of `main` --- libevm/tooling/release/cherrypick.sh | 30 ++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/libevm/tooling/release/cherrypick.sh b/libevm/tooling/release/cherrypick.sh index 9897e576051..aff37c000c2 100755 --- a/libevm/tooling/release/cherrypick.sh +++ b/libevm/tooling/release/cherrypick.sh @@ -1,16 +1,37 @@ #!/usr/bin/env bash +# Copyright 2025 the libevm authors. +# +# The libevm additions to go-ethereum are free software: you can redistribute +# them and/or modify them under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. +# +# The libevm additions are distributed in the hope that they will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with the go-ethereum library. If not, see +# . + +# Usage: run `./cherrypick.sh` on a branch intended to become a release. +# +# Reads the contents of ./cherrypicks, filters out commits that are already +# ancestors of HEAD, and calls `git cherry-pick` with the remaining commit +# hashes. + set -eu; set -o pipefail; SELF_DIR=$(dirname $0) # The format of the `cherrypicks` file is guaranteed by a test so we can use simple parsing here. CHERRY_PICKS=$(cat "${SELF_DIR}/cherrypicks" | grep -Pv "^#" | awk '{print $1}') -RELEASE_REF="main"; commits=() for commit in ${CHERRY_PICKS}; do - git merge-base --is-ancestor "${commit}" "${RELEASE_REF}" && \ + git merge-base --is-ancestor "${commit}" HEAD && \ echo "Skipping ${commit} already in history" && \ continue; @@ -18,4 +39,9 @@ for commit in ${CHERRY_PICKS}; do commits+=("${commit}"); done +if [[ -z "${commits[@]// }" ]]; then # $x// removes whitespace + echo "No commits to cherry-pick"; + exit 0; +fi + git cherry-pick "${commits[@]}"; From 32170245671059032ec6b70f15284a55f4ac2bd3 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 21:10:34 +0000 Subject: [PATCH 15/21] refactor: test of `cherrypicks` file outputs formatted content for copy-paste --- libevm/tooling/go.mod | 1 + libevm/tooling/release/release_test.go | 64 ++++++++++++++++++-------- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/libevm/tooling/go.mod b/libevm/tooling/go.mod index e3738b5c156..05c4f92d52d 100644 --- a/libevm/tooling/go.mod +++ b/libevm/tooling/go.mod @@ -4,6 +4,7 @@ go 1.23 require ( github.com/go-git/go-git/v5 v5.13.2 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.10.0 ) diff --git a/libevm/tooling/release/release_test.go b/libevm/tooling/release/release_test.go index b7fd99b50c7..10aba8613cf 100644 --- a/libevm/tooling/release/release_test.go +++ b/libevm/tooling/release/release_test.go @@ -18,13 +18,16 @@ package release import ( "errors" + "fmt" "regexp" + "sort" "strings" "testing" - "time" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/object" + "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" _ "embed" @@ -33,11 +36,17 @@ import ( var ( //go:embed cherrypicks cherryPicks string - lineFormatRE = regexp.MustCompile(`^([a-fA-F0-9]{40}) #.+$`) + lineFormatRE = regexp.MustCompile(`^([a-fA-F0-9]{40}) # (.*)$`) ) func TestCherryPicksFormat(t *testing.T) { - var commits []string + type parsedLine struct { + hash, commitMsg string + } + var ( + rawLines []string + lines []parsedLine + ) for i, line := range strings.Split(cherryPicks, "\n") { if line == "" || strings.HasPrefix(line, "#") { @@ -45,8 +54,13 @@ func TestCherryPicksFormat(t *testing.T) { } switch matches := lineFormatRE.FindStringSubmatch(line); len(matches) { - case 2: - commits = append(commits, matches[1]) + case 3: + rawLines = append(rawLines, line) + lines = append(lines, parsedLine{ + hash: matches[1], + commitMsg: matches[2], + }) + default: t.Errorf("Line %d is improperly formatted: %s", i, line) } @@ -67,19 +81,33 @@ func TestCherryPicksFormat(t *testing.T) { t.Fatalf("%T.Fetch(%+v) error %v", repo, fetch, err) } - var ( - lastHash string - lastAt time.Time - ) - for _, hash := range commits { - obj, err := repo.CommitObject(plumbing.NewHash(hash)) - require.NoErrorf(t, err, "%T.CommitObject(%q)", repo, hash) + commits := make([]struct { + obj *object.Commit + line parsedLine + }, len(lines)) - at := obj.Committer.When - if !at.After(lastAt) { - t.Errorf("Commit %s (%s) is not after %s (%s)", hash, at, lastHash, lastAt) - } - lastHash = hash - lastAt = at + for i, line := range lines { + obj, err := repo.CommitObject(plumbing.NewHash(line.hash)) + require.NoErrorf(t, err, "%T.CommitObject(%q)", repo, line.hash) + + commits[i].obj = obj + commits[i].line = line + } + sort.Slice(commits, func(i, j int) bool { + ci, cj := commits[i].obj, commits[j].obj + return ci.Committer.When.Before(cj.Committer.When) + }) + + var want []string + for _, c := range commits { + msg := strings.Split(c.obj.Message, "\n")[0] + want = append( + want, + fmt.Sprintf("%s # %s", c.line.hash, msg), + ) + } + if diff := cmp.Diff(want, rawLines); diff != "" { + t.Errorf("Commits in `cherrypicks` file out of order or have incorrect commit message(s);\n(-want +got):\n%s", diff) + t.Logf("To fix, copy:\n%s", strings.Join(want, "\n")) } } From 7290a32e5990af257e5362331b95752e13b250bb Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 21:10:52 +0000 Subject: [PATCH 16/21] chore: extend cherry-picked commits --- libevm/tooling/release/cherrypicks | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libevm/tooling/release/cherrypicks b/libevm/tooling/release/cherrypicks index 27d850c37b7..d9ff1e017db 100644 --- a/libevm/tooling/release/cherrypicks +++ b/libevm/tooling/release/cherrypicks @@ -1,5 +1,13 @@ # Lines starting with # are ignored as comments. -# All other lines MUST have the format [ # ]. -2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # libevm branch point, known to be in history, tests cherry-pick skipping -69f815f6f5791e0e48160bdad284773d0ffb1ba9 # print ConfigCompatError time -159fb1a1db551c544978dc16a5568a4730b4abf3 # S256.IsOnCurve() check +# All other lines MUST have the format [ # ]. +# Commits MUST be in chronological order. +# A test in release_test.go will enforce this / provide the correct lines to copy and paste. +# +2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # Merge branch 'master' into release/1.13 +99bbbc0277e34fc3a31512a345ba20874ae98e18 # internal/build, rpc: add missing HTTP response body Close() calls (#29223) +1e9bf2a09ed3d82ac1aa69750a556f3ce127721d # core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563) +69f815f6f5791e0e48160bdad284773d0ffb1ba9 # params: print time value instead of pointer in ConfigCompatError (#29514) +e4b8058d5a5832cdebdac7da385cf6d829c0d433 # eth/gasprice: add query limit for FeeHistory to defend DDOS attack (#29644) +34b46a2f756da71595ac84eb7f25441f2a5b6ebb # core/state/snapshot: add a missing lock (#30001) +159fb1a1db551c544978dc16a5568a4730b4abf3 # crypto: add IsOnCurve check (#31100) +da71839a270a353bac92e3108e4b74fb0eefec29 # internal/ethapi: fix panic in debug methods (#31157) From 4201689b1a6869550d710716e14f235951cdbec2 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Thu, 13 Feb 2025 21:13:48 +0000 Subject: [PATCH 17/21] doc: explain first no-op cherry-picked commit --- libevm/tooling/release/cherrypicks | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libevm/tooling/release/cherrypicks b/libevm/tooling/release/cherrypicks index d9ff1e017db..58eeb1b0287 100644 --- a/libevm/tooling/release/cherrypicks +++ b/libevm/tooling/release/cherrypicks @@ -3,6 +3,8 @@ # Commits MUST be in chronological order. # A test in release_test.go will enforce this / provide the correct lines to copy and paste. # +# The very first commit is where libevm branched off geth and is included to confirm that it is skipped. +# 2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1 # Merge branch 'master' into release/1.13 99bbbc0277e34fc3a31512a345ba20874ae98e18 # internal/build, rpc: add missing HTTP response body Close() calls (#29223) 1e9bf2a09ed3d82ac1aa69750a556f3ce127721d # core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563) From c06a2ad7304b1245358cacd95930431038b8ed6e Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Fri, 14 Feb 2025 15:46:17 +0000 Subject: [PATCH 18/21] chore(ci): `shellcheck` job --- .github/workflows/shellcheck.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000000..14d2ea61ac6 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,19 @@ +name: Shellcheck + +on: + pull_request: + branches: [main] + paths: + - "**/*.sh" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master From ffdc21fa277c10a7d3fbaaa40d43d8bba598ca33 Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Fri, 14 Feb 2025 15:58:31 +0000 Subject: [PATCH 19/21] chore(ci): limit `shellcheck` to `./libevm` --- .github/workflows/shellcheck.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 14d2ea61ac6..0e3f1f2218f 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,10 +1,11 @@ -name: Shellcheck +name: shellcheck on: + push: + branches: [main, "release/**"] pull_request: - branches: [main] - paths: - - "**/*.sh" + branches: [main, "release/**"] + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -16,4 +17,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master + uses: ludeeus/action-shellcheck@2.0.0 + with: + scandir: './scripts' From 331a197ca435b076a1bad5df6dfc36a5a1d0afaa Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Fri, 14 Feb 2025 16:00:18 +0000 Subject: [PATCH 20/21] chore(ci): _actually_ limit `shellcheck` to `./libevm` --- .github/workflows/shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 0e3f1f2218f..8e91378eb06 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -19,4 +19,4 @@ jobs: - name: Run ShellCheck uses: ludeeus/action-shellcheck@2.0.0 with: - scandir: './scripts' + scandir: './libevm' From 13a1e5ed010b2c88f7ad51af077d367a5bbaa2ef Mon Sep 17 00:00:00 2001 From: Arran Schlosberg Date: Fri, 14 Feb 2025 16:01:35 +0000 Subject: [PATCH 21/21] chore: placate `shellcheck` --- libevm/tooling/release/cherrypick.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libevm/tooling/release/cherrypick.sh b/libevm/tooling/release/cherrypick.sh index aff37c000c2..89ede978e81 100755 --- a/libevm/tooling/release/cherrypick.sh +++ b/libevm/tooling/release/cherrypick.sh @@ -25,9 +25,9 @@ set -eu; set -o pipefail; -SELF_DIR=$(dirname $0) +SELF_DIR=$(dirname "${0}") # The format of the `cherrypicks` file is guaranteed by a test so we can use simple parsing here. -CHERRY_PICKS=$(cat "${SELF_DIR}/cherrypicks" | grep -Pv "^#" | awk '{print $1}') +CHERRY_PICKS=$(< "${SELF_DIR}/cherrypicks" grep -Pv "^#" | awk '{print $1}') commits=() for commit in ${CHERRY_PICKS}; do @@ -39,7 +39,7 @@ for commit in ${CHERRY_PICKS}; do commits+=("${commit}"); done -if [[ -z "${commits[@]// }" ]]; then # $x// removes whitespace +if [[ -z "${commits[*]// }" ]]; then # $x// removes whitespace echo "No commits to cherry-pick"; exit 0; fi