feat: compile ccc (#741)

* update Makefile

* update

* fix github action
This commit is contained in:
HAOYUatHZ 2024-05-07 16:04:32 +08:00 committed by GitHub
parent 40f30fd7be
commit 2d335724b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 7 deletions

View file

@ -14,7 +14,7 @@ on:
- ready_for_review - ready_for_review
name: CI name: CI
jobs: jobs:
build: build-mock-ccc-geth: # build geth with mock circuit capacity checker
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -26,6 +26,28 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Build - name: Build
run: | run: |
make nccc_geth
build-geth: # build geth with circuit capacity checker
if: github.event_name == 'push' # will only be triggered when pushing to main & staging & develop & alpha
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-12-10
override: true
components: rustfmt, clippy
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
make libzkp
sudo cp ./rollup/circuitcapacitychecker/libzkp/libzkp.so /usr/local/lib/
sudo cp ./rollup/circuitcapacitychecker/libzkp/libzktrie.so /usr/local/lib/
make geth make geth
# check: # check:
# if: github.event.pull_request.draft == false # if: github.event.pull_request.draft == false

View file

@ -2,17 +2,25 @@
# with Go source code. If you know what GOPATH is then you probably # with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make. # don't need to bother with make.
.PHONY: geth android ios evm all test clean .PHONY: geth android ios evm all test clean libzkp
GOBIN = ./build/bin GOBIN = ./build/bin
GO ?= latest GO ?= latest
GORUN = go run GORUN = go run
geth: libzkp:
cd $(PWD)/rollup/circuitcapacitychecker/libzkp && make libzkp
nccc_geth: ## geth without circuit capacity checker
$(GORUN) build/ci.go install ./cmd/geth $(GORUN) build/ci.go install ./cmd/geth
@echo "Done building." @echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth." @echo "Run \"$(GOBIN)/geth\" to launch geth."
geth: libzkp ## geth with circuit capacity checker
$(GORUN) build/ci.go install -tags circuit_capacity_checker ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."
all: all:
$(GORUN) build/ci.go install $(GORUN) build/ci.go install

View file

@ -190,6 +190,7 @@ func doInstall(cmdline []string) {
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")
staticlink = flag.Bool("static", false, "Create statically-linked executable") staticlink = flag.Bool("static", false, "Create statically-linked executable")
gobuildtags = flag.String("tags", "", "Tags for go build")
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
env := build.Env() env := build.Env()
@ -208,6 +209,10 @@ func doInstall(cmdline []string) {
buildTags = append(buildTags, "ckzg") buildTags = append(buildTags, "ckzg")
} }
if len(*gobuildtags) > 0 {
buildTags = append(buildTags, strings.Split(*gobuildtags, ",")...)
}
// Configure the build. // Configure the build.
gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...) gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...)