Skip to content

Commit

Permalink
refactor: reorganize repo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Dec 3, 2023
1 parent b89826d commit 43fd7b0
Show file tree
Hide file tree
Showing 53 changed files with 32 additions and 28 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,21 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build yield tool
run: cd linux/htif && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make yield.toolchain"
run: cd sys-utils/yield && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make yield.toolchain"

- name: Build ioctl-echo-loop tool
run: cd linux/rollup/ioctl-echo-loop && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make ioctl-echo-loop.toolchain"
run: cd sys-utils/ioctl-echo-loop && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make ioctl-echo-loop.toolchain"

- name: Build rollup tool
run: cd linux/rollup/rollup && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make rollup.toolchain"
run: cd sys-utils/rollup && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make rollup.toolchain"

- name: Build rollup http server
run: cd linux/rollup/http/rollup-http-server && ./build.sh
run: cd rollup-http/rollup-http-server && ./build.sh

- name: Build echo dapp
run: cd linux/rollup/http/echo-dapp && ./build.sh
run: cd rollup-http/echo-dapp && ./build.sh

- name: Test rollup-http-server and echo-dapp client
run: |
cd linux/rollup/http/rollup-http-server
cd rollup-http/rollup-http-server
USE_ROLLUP_BINDINGS_MOCK=1 cargo test -- --show-output --test-threads=1
43 changes: 24 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
rm -rf /var/lib/apt/lists/* ${LINUX_HEADERS_FILEPATH}

FROM tools-env as builder
COPY linux/ ${BUILD_BASE}/tools/linux/
COPY sys-utils/ ${BUILD_BASE}/tools/sys-utils/

# build C/C++ tools
# ------------------------------------------------------------------------------
FROM builder as c-builder
RUN make -C ${BUILD_BASE}/tools/linux/xhalt/ CROSS_COMPILE="" xhalt.toolchain
RUN make -C ${BUILD_BASE}/tools/linux/htif/ CROSS_COMPILE="" yield.toolchain
RUN make -C ${BUILD_BASE}/tools/linux/rollup/ioctl-echo-loop/ CROSS_COMPILE="" ioctl-echo-loop.toolchain
RUN make -C ${BUILD_BASE}/tools/linux/rollup/rollup/ CROSS_COMPILE="" rollup.toolchain
RUN make -C ${BUILD_BASE}/tools/sys-utils/xhalt/ CROSS_COMPILE="" xhalt.toolchain
RUN make -C ${BUILD_BASE}/tools/sys-utils/yield/ CROSS_COMPILE="" yield.toolchain
RUN make -C ${BUILD_BASE}/tools/sys-utils/ioctl-echo-loop/ CROSS_COMPILE="" ioctl-echo-loop.toolchain
RUN make -C ${BUILD_BASE}/tools/sys-utils/rollup/ CROSS_COMPILE="" rollup.toolchain

# build rust tools
# ------------------------------------------------------------------------------
Expand All @@ -61,12 +61,14 @@ RUN mkdir -p $HOME/.cargo && \
echo "[net]" >> $HOME/.cargo/config && \
echo "git-fetch-with-cli = true" >> $HOME/.cargo/config

FROM rust-builder as echo-dapp-builder
RUN cd ${BUILD_BASE}/tools/linux/rollup/http/echo-dapp && \
cargo build --release
COPY rollup-http/ ${BUILD_BASE}/tools/rollup-http/

FROM rust-builder as http-server-builder
RUN cd ${BUILD_BASE}/tools/linux/rollup/http/rollup-http-server && \
RUN cd ${BUILD_BASE}/tools/rollup-http/rollup-http-server && \
cargo build --release

FROM rust-builder as echo-dapp-builder
RUN cd ${BUILD_BASE}/tools/rollup-http/echo-dapp && \
cargo build --release

# pack tools (deb)
Expand All @@ -75,19 +77,22 @@ FROM c-builder as packer
ARG TOOLS_DEB=machine-emulator-tools.deb
ARG STAGING_BASE=${BUILD_BASE}/_install
ARG STAGING_DEBIAN=${STAGING_BASE}/DEBIAN
ARG STAGING_BIN=${STAGING_BASE}/opt/cartesi/bin
ARG STAGING_SBIN=${STAGING_BASE}/usr/sbin
ARG STAGING_BIN=${STAGING_BASE}/usr/bin

RUN mkdir -p ${STAGING_DEBIAN} ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/linux/xhalt/xhalt ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/linux/htif/yield ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/linux/rollup/ioctl-echo-loop/ioctl-echo-loop ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/linux/rollup/rollup/rollup ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/linux/utils/* ${STAGING_BIN}
RUN mkdir -p ${STAGING_DEBIAN} ${STAGING_SBIN} ${STAGING_BIN} ${STAGING_BASE}/etc && \
echo "cartesi-machine" > ${staging_base}/etc/hostname && \
cp ${BUILD_BASE}/tools/sys-utils/system-init/system-init ${STAGING_SBIN} && \
cp ${BUILD_BASE}/tools/sys-utils/xhalt/xhalt ${STAGING_SBIN} && \
cp ${BUILD_BASE}/tools/sys-utils/yield/yield ${STAGING_SBIN} && \
cp ${BUILD_BASE}/tools/sys-utils/rollup/rollup ${STAGING_SBIN} && \
cp ${BUILD_BASE}/tools/sys-utils/ioctl-echo-loop/ioctl-echo-loop ${STAGING_BIN} && \
cp ${BUILD_BASE}/tools/sys-utils/misc/* ${STAGING_BIN}

COPY skel/ ${STAGING_BASE}/
COPY control ${STAGING_DEBIAN}/control

COPY --from=echo-dapp-builder ${BUILD_BASE}/tools/linux/rollup/http/echo-dapp/target/release/echo-dapp ${STAGING_BIN}
COPY --from=http-server-builder ${BUILD_BASE}/tools/linux/rollup/http/rollup-http-server/target/release/rollup-http-server ${STAGING_BIN}
COPY --from=rust-builder ${BUILD_BASE}/tools/rollup-http/rollup-init/rollup-init ${STAGING_SBIN}
COPY --from=http-server-builder ${BUILD_BASE}/tools/rollup-http/rollup-http-server/target/release/rollup-http-server ${STAGING_BIN}
COPY --from=echo-dapp-builder ${BUILD_BASE}/tools/rollup-http/echo-dapp/target/release/echo-dapp ${STAGING_BIN}

RUN dpkg-deb -Zxz --root-owner-group --build ${STAGING_BASE} ${BUILD_BASE}/${TOOLS_DEB}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ $(TOOLS_ROOTFS) fs: $(TOOLS_DEB)
@docker buildx build --platform=linux/riscv64 \
--build-arg TOOLS=$(TOOLS_DEB) \
--output type=tar,dest=rootfs.tar \
--file fs.Dockerfile \
--file fs/Dockerfile \
. && \
bsdtar -cf rootfs.gnutar --format=gnutar @rootfs.tar && \
xgenext2fs -fzB 4096 -i 4096 -a rootfs.gnutar -L rootfs $(TOOLS_ROOTFS) && \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

busybox sh -c "/opt/cartesi/bin/rollup-http-server $*"
busybox sh -c "/usr/bin/rollup-http-server $*"
MESSAGE="rollup-http-server exited with $? status"
echo "$MESSAGE"
echo "{\"payload\": \"$MESSAGE\"}" | rollup exception
1 change: 0 additions & 1 deletion skel/etc/hostname

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 43fd7b0

Please sign in to comment.