Skip to content

Commit

Permalink
Experimental FreeBSD CI (#2)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
xxuejie authored Jan 9, 2024
1 parent 4ddf46c commit 2d749c7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions workspace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ 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:
#
# 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.
Expand Down

0 comments on commit 2d749c7

Please sign in to comment.