Skip to content

Commit 13ec6fa

Browse files
authored
Compile native crates in make build as well (#16)
* Compile native crates in `make build` as well * Disable unstable test in CI
1 parent c176286 commit 13ec6fa

File tree

2 files changed

+43
-35
lines changed

2 files changed

+43
-35
lines changed

.github/workflows/rust.yml

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -239,41 +239,42 @@ jobs:
239239
# References:
240240
# * https://github.com/orgs/community/discussions/69211
241241
# * https://github.com/marketplace/actions/setup-docker-on-macos
242-
macos-x64-reproducible-build:
243-
244-
runs-on: macos-13
245-
246-
steps:
247-
- uses: actions/checkout@v3
248-
with:
249-
submodules: true
250-
- name: Setup Docker on macOS
251-
run: brew install docker colima && colima start
252-
- name: Install llvm 16
253-
run: brew install llvm@16
254-
- name: Install riscv64 target
255-
run: rustup target add riscv64imac-unknown-none-elf
256-
- name: Install cargo generate
257-
run: cargo install cargo-generate
258-
- name: Generate workspace
259-
run: cargo generate --path . workspace --name test-workspace
260-
- name: Generate crates && contracts
261-
run: cd test-workspace &&
262-
make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
263-
make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
264-
make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
265-
make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
266-
make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=..
267-
- name: Submodules
268-
run: cd test-workspace &&
269-
git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
270-
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
271-
- name: Reproducible build runs
272-
run: cd test-workspace && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
273-
- name: Generate standalone contract
274-
run: cargo generate --path . standalone-contract --name test-contract
275-
- name: Reproducible build runs
276-
run: cd test-contract && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
242+
# NOTE: this test is not stable right now, disabling it till we can find a better solution
243+
# macos-x64-reproducible-build:
244+
#
245+
# runs-on: macos-13
246+
#
247+
# steps:
248+
# - uses: actions/checkout@v3
249+
# with:
250+
# submodules: true
251+
# - name: Setup Docker on macOS
252+
# run: brew install docker colima && colima start
253+
# - name: Install llvm 16
254+
# run: brew install llvm@16
255+
# - name: Install riscv64 target
256+
# run: rustup target add riscv64imac-unknown-none-elf
257+
# - name: Install cargo generate
258+
# run: cargo install cargo-generate
259+
# - name: Generate workspace
260+
# run: cargo generate --path . workspace --name test-workspace
261+
# - name: Generate crates && contracts
262+
# run: cd test-workspace &&
263+
# make generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
264+
# make generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
265+
# make generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
266+
# make generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. &&
267+
# make generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=..
268+
# - name: Submodules
269+
# run: cd test-workspace &&
270+
# git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib &&
271+
# git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
272+
# - name: Reproducible build runs
273+
# run: cd test-workspace && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
274+
# - name: Generate standalone contract
275+
# run: cargo generate --path . standalone-contract --name test-contract
276+
# - name: Reproducible build runs
277+
# run: cd test-contract && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
277278

278279
windows-build:
279280

workspace/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ CONTRACT :=
2323
CLEAN_BUILD_DIR_FIRST := true
2424
BUILD_DIR := build/$(MODE)
2525

26+
ifeq (release,$(MODE))
27+
MODE_ARGS := --release
28+
endif
29+
2630
# Pass setups to child make processes
2731
export CUSTOM_RUSTFLAGS
2832
export TOP
@@ -44,6 +48,9 @@ build:
4448
for contract in $(wildcard contracts/*); do \
4549
$(MAKE) -e -C $$contract build; \
4650
done; \
51+
for crate in $(wildcard crates/*); do \
52+
cargo build -p $$(basename $$crate) $(MODE_ARGS) $(CARGO_ARGS); \
53+
done; \
4754
else \
4855
$(MAKE) -e -C contracts/$(CONTRACT) build; \
4956
fi

0 commit comments

Comments
 (0)