Skip to content

Commit 9629bed

Browse files
committed
Add note & CI on reproducible builds for macOS
1 parent a5ca126 commit 9629bed

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ jobs:
176176
submodules: true
177177
- name: Install llvm 16
178178
run: brew install llvm@16
179+
- name: Install coreutils
180+
run: brew install coreutils
179181
- name: Install riscv64 target
180182
run: rustup target add riscv64imac-unknown-none-elf
181183
- name: Install cargo generate
@@ -195,6 +197,8 @@ jobs:
195197
git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics
196198
- name: Run all checks
197199
run: cd test-workspace && make build test check clippy
200+
- name: Reproducible build runs
201+
run: cd test-workspace && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
198202
- name: Generate standalone contract
199203
run: cargo generate --path . standalone-contract --name test-contract
200204
- name: Run all checks

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ The templates provided here, use the same conventions as `ckb-native-build-sampl
173173

174174
### Reproducible Build
175175

176-
When using this set of templates, we always recommend to use locally installed native versions of LLVM & Rust to build and test your scripts. However, reproducible build is an important part of CKB scripts, which would require locked versions of LLVM & Rust to work, which might not be an easy task when using locally installed versions of compilers.
176+
When using this set of templates, we always recommend to use locally installed native versions of LLVM & Rust to build and test your scripts. However, reproducible build is an important part of CKB scripts, which would require locked versions of LLVM & Rust to work. It might not be an easy task when using locally installed versions of compilers.
177177

178178
For the time being, we have prepared a script that does reproducible build via [a docker container image](https://github.com/cryptape/llvm-n-rust). We do want to mention that docker is not necessarily THE way to do reproducible build, nor is it the best way to do reproducible build. There might well be other ways that are better, such as chroot or Nix. It's just that historically, docker has been used in CKB script's build process, and adding a script leveraging docker here, provides an easy solution into the issue.
179179

@@ -195,6 +195,12 @@ $ ./scripts/reproducible_build_docker --proxy "..." # Setup docker container so
195195

196196
By default, the checksum file is stored in `checksums.txt` in the root of the repository. It is strongly recommended that this file is checked into version control, and a CI is setup so reproducible build is always checked in new commits.
197197

198+
Note that reproducible build here relies on the presence of `sha256sum` command, if you are using macOS, you can install it via the following command:
199+
200+
```
201+
brew install coreutils
202+
```
203+
198204
### Standalone Contract Crate
199205

200206
In rare cases if you want to simply use a standalone contract crate without a workspace. The [standalone-contract](https://github.com/cryptape/ckb-script-templates/tree/main/standalone-contract) template is prepared for you:

0 commit comments

Comments
 (0)