Skip to content

Commit

Permalink
refactor: refactor build and tests pipeline
Browse files Browse the repository at this point in the history
* introduce `just` and rewrite makefiles into justfiles
* unify all cargo workspaces into a single cargo workspace;
* unify all Dockerfiles into a single Dockerfile;
* implement anvil deployments as state dumps and loads;
* update `blockchain-reader` tests to load anvil state;
* Change PRT time from timestamp to block number;
* refactor `echo` program build;
* implement node state directory configuration;
* update PRT tests to newest changes;
* simplify `machine-runner` test;
* fix `persistent-state-access` tests;
* add ci (check/fmt/build/test) with cache;
* add machine bindings to workspace;
* rename `rollups-compute-runner` to `rollups-prt-runner`;
* extract `prt/tests` shared modules into `prt/tests/common` dir;
* remove `step` dependency on `CanonicalConstants`;
* remove unused files.
  • Loading branch information
GCdePaula committed Jan 16, 2025
1 parent e3e151f commit 45f3409
Show file tree
Hide file tree
Showing 120 changed files with 2,186 additions and 5,282 deletions.
86 changes: 80 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,80 @@
.vscode
/**/target/
/**/snapshots/
Cargo.lock
/**/compute_data/
/**/rollups_data/
**/.git
**/.github
**/.venv
**/.vscode
**/.DS_Store

**/target/

**/_state/
**/snapshots/
**/compute_data/
**/rollups_data/

**/out/
**/cache/

test/programs/linux.bin
test/programs/rootfs.ext2
test/programs/**/machine-image/
test/programs/**/addresses
test/programs/**/anvil_state.json
test/programs/**/_anvil.log

cartesi-rollups/contracts/bindings-rs/src/contract/
prt/contracts/bindings-rs/src/contract/

prt/tests/compute/outputs/
prt/tests/compute/pixels/

machine/emulator/**/*.o
machine/emulator/**/*.swp
machine/emulator/**/*.d
machine/emulator/**/*.pb.cc
machine/emulator/**/*.pb.h
machine/emulator/**/*.gcno
machine/emulator/**/*.so
machine/emulator/**/*.dtb
machine/emulator/**/*.bin
machine/emulator/**/*.md
machine/emulator/**/*.deb

machine/emulator/src/*.pb.h
machine/emulator/src/*.pb.cc
machine/emulator/src/*.ext2
machine/emulator/src/*.bin
machine/emulator/src/*.gcno
machine/emulator/src/*.gcov
machine/emulator/src/*.gcda
machine/emulator/src/*.profraw
machine/emulator/src/compile_flags.txt
machine/emulator/src/coverage*
machine/emulator/src/jsonrpc-discover.cpp
machine/emulator/src/machine-c-version.h

machine/emulator/build
machine/emulator/third-party/downloads
machine/emulator/src/cartesi-machine-client
machine/emulator/src/cartesi-machine-server
machine/emulator/src/cartesi-machine-hash
machine/emulator/doc/

machine/emulator/**/*.clang-tidy
machine/emulator/**/*.a
machine/emulator/**/*.lib
machine/emulator/**/*.wasm
machine/emulator/**/*.tar.gz
machine/emulator/**/*.raw
machine/emulator/**/*.so
machine/emulator/**/*.dll
machine/emulator/**/*.exe
machine/emulator/**/*.dylib
machine/emulator/**/*.dtb
machine/emulator/**/*.tmp
machine/emulator/**/*.ld
machine/emulator/**/*.elf
machine/emulator/**/*.bin

machine/emulator/uarch/uarch-pristine-hash.c
machine/emulator/uarch/uarch-pristine-ram.c
machine/emulator/uarch/compute-uarch-pristine-hash
File renamed without changes
53 changes: 49 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,65 @@
name: Build
on: [push]
on:
push:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up cache for Foundry
uses: actions/cache@v3
with:
path: ~/.foundry
key: ${{ runner.os }}-foundry-${{ hashFiles('**/foundry.toml') }}
restore-keys: |
${{ runner.os }}-foundry-
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install just
uses: extractions/setup-just@v2

- name: Build, format check and test
working-directory: ./prt/contracts
run: |
forge build
forge fmt --check
forge test
just check-fmt
just build-smart-contracts
just test
- name: Set up cache for Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Deps
run: |
export CARTESI_MACHINE_VERSION=0.18.1
sudo apt-get install -y libboost-all-dev lua5.4 libslirp0
wget https://github.com/cartesi/machine-emulator/releases/download/v0.18.1/cartesi-machine-v${CARTESI_MACHINE_VERSION}_amd64.deb
sudo dpkg -i ./cartesi-machine-v${CARTESI_MACHINE_VERSION}_amd64.deb
rm ./cartesi-machine-v${CARTESI_MACHINE_VERSION}_amd64.deb
- name: Rust fmt and check
run: |
just setup
just check-fmt-rust-workspace
just check-rust-workspace
- name: Rust build
run: |
just build-rust-workspace
- name: Rust test workspace
run: |
just test-rust-workspace
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
.bin
.env
.vscode
.DS_Store
**/.DS_Store
**/.idea/
target/
snapshots/
common-rs/Cargo.lock
prt/client-rs/Cargo.lock
prt/tests/compute/outputs/
prt/tests/compute/pixels/
node_modules
**/contract-bindings/src/contract
**/contract-bindings/Cargo.lock
**/snapshots/
**/compute_data/
**/rollups_data/
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Gabriel Coutinho de Paula <[email protected]>
Guilherme Dantas <[email protected]>
Stephen Chen <[email protected]>
Loading

0 comments on commit 45f3409

Please sign in to comment.