ci: fix release job (#1519)

* ci: remove CGO_ENABLE=0 due to blst package
* ci: fix arm binary build
* ci: remove arm5-7 version
* ci: fix arm64 build script
* ci: fix generate_change_log.sh
This commit is contained in:
dylanhuang 2023-04-24 22:30:27 +08:00 committed by GitHub
parent b6274dd2df
commit 282ef8952d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 81 additions and 142 deletions

@ -24,26 +24,20 @@ TESTNET_ZIP_SUM="$(checksum ./testnet.zip)"
LINUX_BIN_SUM="$(checksum ./linux/geth)" LINUX_BIN_SUM="$(checksum ./linux/geth)"
MAC_BIN_SUM="$(checksum ./macos/geth)" MAC_BIN_SUM="$(checksum ./macos/geth)"
WINDOWS_BIN_SUM="$(checksum ./windows/geth.exe)" WINDOWS_BIN_SUM="$(checksum ./windows/geth.exe)"
ARM5_BIN_SUM="$(checksum ./arm5/geth-linux-arm-5)"
ARM6_BIN_SUM="$(checksum ./arm6/geth-linux-arm-6)"
ARM7_BIN_SUM="$(checksum ./arm7/geth-linux-arm-7)"
ARM64_BIN_SUM="$(checksum ./arm64/geth-linux-arm64)" ARM64_BIN_SUM="$(checksum ./arm64/geth-linux-arm64)"
OUTPUT=$(cat <<-END OUTPUT=$(cat <<-END
## Changelog\n ## Changelog\n
${CHANGE_LOG}\n ${CHANGE_LOG}\n
## Assets\n ## Assets\n
| Assets | Sha256 Checksum |\n | Assets | Sha256 Checksum |
| :-----------: |------------|\n | :-----------: |------------|
| mainnet.zip | ${MAINNET_ZIP_SUM} |\n | mainnet.zip | ${MAINNET_ZIP_SUM} |
| testnet.zip | ${TESTNET_ZIP_SUM} |\n | testnet.zip | ${TESTNET_ZIP_SUM} |
| geth_linux | ${LINUX_BIN_SUM} |\n | geth_linux | ${LINUX_BIN_SUM} |
| geth_mac | ${MAC_BIN_SUM} |\n | geth_mac | ${MAC_BIN_SUM} |
| geth_windows | ${WINDOWS_BIN_SUM} |\n | geth_windows | ${WINDOWS_BIN_SUM} |
| geth_linux_arm-5 | ${ARM5_BIN_SUM} |\n
| geth_linux_arm-6 | ${ARM6_BIN_SUM} |\n
| geth_linux_arm-7 | ${ARM7_BIN_SUM} |\n
| geth_linux_arm64 | ${ARM64_BIN_SUM} |\n | geth_linux_arm64 | ${ARM64_BIN_SUM} |\n
END END
) )
echo -e ${OUTPUT} echo -e "${OUTPUT}"

@ -44,8 +44,17 @@ jobs:
# ============================== # ==============================
- name: Build Binary for ${{matrix.os}} - name: Build Binary for ${{matrix.os}}
env: if: matrix.os == 'ubuntu-latest'
CGO_ENABLED: "0" run: |
go mod download
wget https://musl.cc/x86_64-linux-musl-cross.tgz
tar -xvf ./x86_64-linux-musl-cross.tgz
GIT_COMMIT=$(git rev-parse HEAD)
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth -a ./cmd/geth
- name: Build Binary for ${{matrix.os}}
if: matrix.os != 'ubuntu-latest'
run: | run: |
go mod download go mod download
make geth make geth
@ -58,7 +67,12 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: | run: |
go mod download go mod download
make geth-linux-arm wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar -xvf ./aarch64-linux-musl-cross.tgz
GIT_COMMIT=$(git rev-parse HEAD)
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth-linux-arm64 -a ./cmd/geth
# ============================== # ==============================
# Upload artifacts # Upload artifacts
# ============================== # ==============================
@ -84,27 +98,6 @@ jobs:
name: windows name: windows
path: ./build/bin/geth.exe path: ./build/bin/geth.exe
- name: Upload ARM-5 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm5
path: ./build/bin/geth-linux-arm-5
- name: Upload ARM-6 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm6
path: ./build/bin/geth-linux-arm-6
- name: Upload ARM-7 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm7
path: ./build/bin/geth-linux-arm-7
- name: Upload ARM-64 Build - name: Upload ARM-64 Build
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
@ -145,24 +138,6 @@ jobs:
name: windows name: windows
path: ./windows path: ./windows
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm5
path: ./arm5
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm6
path: ./arm6
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm7
path: ./arm7
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@ -204,7 +179,4 @@ jobs:
./linux/geth_linux ./linux/geth_linux
./macos/geth_macos ./macos/geth_macos
./windows/geth_windows.exe ./windows/geth_windows.exe
./arm5/geth-linux-arm-5
./arm6/geth-linux-arm-6
./arm7/geth-linux-arm-7
./arm64/geth-linux-arm64 ./arm64/geth-linux-arm64

@ -44,8 +44,17 @@ jobs:
# ============================== # ==============================
- name: Build Binary for ${{matrix.os}} - name: Build Binary for ${{matrix.os}}
env: if: matrix.os == 'ubuntu-latest'
CGO_ENABLED: "0" run: |
go mod download
wget https://musl.cc/x86_64-linux-musl-cross.tgz
tar -xvf ./x86_64-linux-musl-cross.tgz
GIT_COMMIT=$(git rev-parse HEAD)
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth -a ./cmd/geth
- name: Build Binary for ${{matrix.os}}
if: matrix.os != 'ubuntu-latest'
run: | run: |
go mod download go mod download
make geth make geth
@ -58,7 +67,12 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: | run: |
go mod download go mod download
make geth-linux-arm wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar -xvf ./aarch64-linux-musl-cross.tgz
GIT_COMMIT=$(git rev-parse HEAD)
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth-linux-arm64 -a ./cmd/geth
# ============================== # ==============================
# Upload artifacts # Upload artifacts
# ============================== # ==============================
@ -84,27 +98,6 @@ jobs:
name: windows name: windows
path: ./build/bin/geth.exe path: ./build/bin/geth.exe
- name: Upload ARM-5 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm5
path: ./build/bin/geth-linux-arm-5
- name: Upload ARM-6 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm6
path: ./build/bin/geth-linux-arm-6
- name: Upload ARM-7 Build
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: arm7
path: ./build/bin/geth-linux-arm-7
- name: Upload ARM-64 Build - name: Upload ARM-64 Build
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
@ -145,24 +138,6 @@ jobs:
name: windows name: windows
path: ./windows path: ./windows
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm5
path: ./arm5
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm6
path: ./arm6
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: arm7
path: ./arm7
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@ -211,7 +186,4 @@ jobs:
./linux/geth_linux ./linux/geth_linux
./macos/geth_macos ./macos/geth_macos
./windows/geth_windows.exe ./windows/geth_windows.exe
./arm5/geth-linux-arm-5
./arm6/geth-linux-arm-6
./arm7/geth-linux-arm-7
./arm64/geth-linux-arm64 ./arm64/geth-linux-arm64

@ -13,8 +13,6 @@ COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download RUN cd /go-ethereum && go mod download
ADD . /go-ethereum ADD . /go-ethereum
ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth
# Pull Geth into a second stage deploy alpine container # Pull Geth into a second stage deploy alpine container
@ -28,10 +26,9 @@ ENV BSC_HOME=/bsc
ENV HOME=${BSC_HOME} ENV HOME=${BSC_HOME}
ENV DATA_DIR=/data ENV DATA_DIR=/data
ARG VERSION_GCC=11.2.1_git20220219-r2
ENV PACKAGES ca-certificates jq \ ENV PACKAGES ca-certificates jq \
bash bind-tools tini \ bash bind-tools tini \
grep curl sed gcc==${VERSION_GCC} grep curl sed gcc
RUN apk add --no-cache $PACKAGES \ RUN apk add --no-cache $PACKAGES \
&& rm -rf /var/cache/apk/* \ && rm -rf /var/cache/apk/* \
@ -59,4 +56,7 @@ USER ${BSC_USER_UID}:${BSC_USER_GID}
# rpc ws graphql # rpc ws graphql
EXPOSE 8545 8546 8547 30303 30303/udp EXPOSE 8545 8546 8547 30303 30303/udp
# For blst runtime env
ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"] ENTRYPOINT ["/sbin/tini", "--", "./docker-entrypoint.sh"]

@ -29,3 +29,7 @@ ARG VERSION=""
ARG BUILDNUM="" ARG BUILDNUM=""
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM" LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
# For blst runtime env
ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"

@ -4,7 +4,6 @@
.PHONY: geth android ios evm all test truffle-test clean .PHONY: geth android ios evm all test truffle-test clean
.PHONY: docker .PHONY: docker
.PHONY: geth-linux-arm geth-linux-arm64 geth-linux-arm5 geth-linux-arm6 geth-linux-arm7
GOBIN = ./build/bin GOBIN = ./build/bin
GO ?= latest GO ?= latest
@ -17,23 +16,6 @@ geth:
@echo "Done building." @echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth." @echo "Run \"$(GOBIN)/geth\" to launch geth."
ldflags = -X main.gitCommit=$(GIT_COMMIT) \
-X main.gitDate=$(GIT_COMMIT_DATE)
geth-linux-arm: geth-linux-arm5 geth-linux-arm6 geth-linux-arm7 geth-linux-arm64
geth-linux-arm5:
env GO111MODULE=on GOARCH=arm GOARM=5 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-5 ./cmd/geth
geth-linux-arm6:
env GO111MODULE=on GOARCH=arm GOARM=6 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-6 ./cmd/geth
geth-linux-arm7:
env GO111MODULE=on GOARCH=arm GOARM=7 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm-7 ./cmd/geth
geth-linux-arm64:
env GO111MODULE=on GOARCH=arm64 GOOS=linux go build -ldflags="$(ldflags)" -o build/bin/geth-linux-arm64 ./cmd/geth
all: all:
$(GORUN) build/ci.go install $(GORUN) build/ci.go install

@ -142,6 +142,16 @@ Download latest chaindata snapshot from [here](https://github.com/bnb-chain/bsc-
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none
``` ```
if you get such error:
```shell
Caught SIGILL in blst_cgo_init, consult <blst>/bindinds/go/README.md.
```
please try to add the following environment variables:
```shell
export CGO_CFLAGS="-O -D__BLST_PORTABLE__"
export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
```
#### 5. Monitor node status #### 5. Monitor node status
Monitor the log from **./node/bsc.log** by default. When the node has started syncing, should be able to see the following output: Monitor the log from **./node/bsc.log** by default. When the node has started syncing, should be able to see the following output:

@ -36,7 +36,6 @@ Available commands are:
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
For all commands, -n prevents execution of external programs (dry run mode). For all commands, -n prevents execution of external programs (dry run mode).
*/ */
package main package main
@ -201,6 +200,7 @@ func doInstall(cmdline []string) {
dlgo = flag.Bool("dlgo", false, "Download Go and build with it") dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
arch = flag.String("arch", "", "Architecture to cross build for") arch = flag.String("arch", "", "Architecture to cross build for")
cc = flag.String("cc", "", "C compiler to cross build with") cc = flag.String("cc", "", "C compiler to cross build with")
output = flag.String("o", "", "Output directory for build artifacts")
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
@ -213,7 +213,8 @@ func doInstall(cmdline []string) {
// Configure the build. // Configure the build.
env := build.Env() env := build.Env()
gobuild := tc.Go("build", buildFlags(env)...) buildArgs := buildFlags(env)
gobuild := tc.Go("build", buildArgs...)
// arm64 CI builders are memory-constrained and can't handle concurrent builds, // arm64 CI builders are memory-constrained and can't handle concurrent builds,
// better disable it. This check isn't the best, it should probably // better disable it. This check isn't the best, it should probably
@ -239,7 +240,11 @@ func doInstall(cmdline []string) {
for _, pkg := range packages { for _, pkg := range packages {
args := make([]string, len(gobuild.Args)) args := make([]string, len(gobuild.Args))
copy(args, gobuild.Args) copy(args, gobuild.Args)
args = append(args, "-o", executablePath(path.Base(pkg))) outputPath := executablePath(path.Base(pkg))
if output != nil && *output != "" {
outputPath = *output
}
args = append(args, "-o", outputPath)
args = append(args, pkg) args = append(args, pkg)
build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env}) build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env})
} }