From 2d749c7327a6167607c3396b13778fd8370e7c41 Mon Sep 17 00:00:00 2001 From: Xuejie Xiao Date: Tue, 9 Jan 2024 17:19:39 +0800 Subject: [PATCH] Experimental FreeBSD CI (#2) * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Update rust.yml * Use MAKE environment variable to deal with different make command gmake on FreeBSD for example, requires MAKE env variable to invoke --- .github/workflows/rust.yml | 37 +++++++++++++++++++++++++++++++++++++ workspace/Makefile | 6 +++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c81622b..8730e3e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -196,3 +196,40 @@ jobs: run: cargo generate --path . standalone-contract --name test-contract - name: Run all checks run: cd test-contract && make build test check clippy + + freebsd-build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Build in FreeBSD VM + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + prepare: | + set -ex + pkg install -y llvm16 git gmake bash + curl https://sh.rustup.rs -sSf | sh -s -- -y + . $HOME/.cargo/env + rustup target add riscv64imac-unknown-none-elf + cargo install cargo-generate + run: | + set -ex + . $HOME/.cargo/env + cargo generate --path . standalone-contract --name test-contract + cd test-contract + gmake build test check clippy + cd .. + cargo generate --path . workspace --name test-workspace + cd test-workspace + gmake generate CRATE=clib TEMPLATE=c-wrapper-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. + gmake generate CRATE=rlib TEMPLATE=x64-simulator-crate DESTINATION=crates TEMPLATE_TYPE=--path TEMPLATE_REPO=.. + gmake generate CRATE=c1 TEMPLATE=contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. + gmake generate CRATE=c2 TEMPLATE=atomics-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. + gmake generate CRATE=c3 TEMPLATE=stack-reorder-contract TEMPLATE_TYPE=--path TEMPLATE_REPO=.. + git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib + git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics + gmake build test check clippy diff --git a/workspace/Makefile b/workspace/Makefile index c515e04..54ee459 100644 --- a/workspace/Makefile +++ b/workspace/Makefile @@ -42,10 +42,10 @@ build: @set -eu; \ if [ "x$(CONTRACT)" = "x" ]; then \ for contract in $(wildcard contracts/*); do \ - make -e -C $$contract build; \ + $(MAKE) -e -C $$contract build; \ done; \ else \ - make -e -C contracts/$(CONTRACT) build; \ + $(MAKE) -e -C contracts/$(CONTRACT) build; \ fi # Run a single make task for a specific contract. For example: @@ -53,7 +53,7 @@ build: # make run CONTRACT=stack-reorder TASK=adjust_stack_size STACK_SIZE=0x200000 TASK := run: - make -e -C contracts/$(CONTRACT) $(TASK) + $(MAKE) -e -C contracts/$(CONTRACT) $(TASK) # test, check, clippy and fmt here are provided for completeness, # there is nothing wrong invoking cargo directly instead of make.