Optimize copy-patch add-immediate stencils #2902
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build/Test/Release | |
| on: [push] | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| jobs: | |
| check-commits: | |
| name: Check Commits | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install cocogitto tool | |
| run: | | |
| VERSION=5.6.0 | |
| TAR=cocogitto-${VERSION}-x86_64-unknown-linux-musl.tar.gz | |
| curl --output-dir /tmp -OL https://github.com/cocogitto/cocogitto/releases/download/${VERSION}/${TAR} | |
| sudo tar -xzf /tmp/${TAR} -C /usr/local/bin | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Conventional commit check | |
| run: | | |
| # Assuming 'main' is the default base branch | |
| BASE_BRANCH=${{ github.base_ref || 'origin/main' }} | |
| cog check ${BASE_BRANCH}..HEAD | |
| check-format: | |
| name: Check Format | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: toolchain | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:toolchain | |
| push: false | |
| load: true | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Check format (C++) | |
| run: | | |
| docker run --rm -t -v ${{ github.workspace }}:/usr/src/emulator ${{ github.repository_owner }}/machine-emulator:toolchain make check-format | |
| - name: Check format (Lua) | |
| run: | | |
| docker run --rm -t -v ${{ github.workspace }}:/usr/src/emulator ${{ github.repository_owner }}/machine-emulator:toolchain make check-format-lua | |
| build: | |
| name: Build | |
| needs: [check-format, check-commits] | |
| runs-on: ubuntu-latest-8-cores | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:devel.build | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Load normal-amd64 builder image for computation hash corpus | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build computation hash corpus environment and fixtures | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| target: tests-builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:computation-hash-corpus | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Record and archive computation hash corpus | |
| run: | | |
| docker run --name computation-hash-corpus -t ${{ github.repository_owner }}/machine-emulator:computation-hash-corpus make build-computation-hash-corpus archive-computation-hash-corpus | |
| docker cp computation-hash-corpus:/usr/src/emulator/tests/computation-hash-corpus.tar.gz . | |
| docker rm computation-hash-corpus | |
| tar -tzf computation-hash-corpus.tar.gz | |
| - name: Upload computation hash corpus | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: computation-hash-corpus | |
| path: computation-hash-corpus.tar.gz | |
| compression-level: 0 | |
| - name: Build debian package (amd64) | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: debian-packager | |
| platforms: linux/amd64 | |
| tags: cartesi/machine-emulator:amd64_deb | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Export deb package artifact (amd64) | |
| run: make copy BUILD_PLATFORM=linux/amd64 DEB_ARCH=amd64 DEBIAN_IMG=cartesi/machine-emulator:amd64_deb | |
| - name: Build debian package (arm64) | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: debian-packager | |
| platforms: linux/arm64 | |
| tags: cartesi/machine-emulator:arm64_deb | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Export deb package artifact (arm64) | |
| run: make copy BUILD_PLATFORM=linux/arm64 DEB_ARCH=arm64 DEBIAN_IMG=cartesi/machine-emulator:arm64_deb | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: artifacts | |
| path: | | |
| uarch-ram.bin | |
| uarch-pristine-ram.c | |
| uarch-pristine-hash.c | |
| cm-version.h | |
| interpret-jump-table.hpp | |
| machine-emulator_amd64.deb | |
| machine-emulator_arm64.deb | |
| test_amd64: | |
| name: Test (linux/amd64) | |
| needs: build | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build machine-emulator "builder" docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:devel | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:tests | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Simple boot inside the docker image | |
| run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine /bin/true | |
| - name: Run test suite inside the docker image | |
| run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine-tests run | |
| - name: Run test suite with log_step inside the docker image | |
| run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine-tests run_step | |
| - name: Save and Load | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-save-and-load.sh | |
| - name: Yield and Save | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-yield-and-save.sh | |
| - name: Run test scripts | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/run-lua-tests.sh | |
| - name: Run jsonrpc lua test scripts | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-jsonrpc-server.sh cartesi-jsonrpc-machine cartesi-machine cartesi-machine-tests | |
| - name: Create cmio templates | |
| run: | | |
| docker run --rm -t -v cmio-templates:/tmp/cartesi-machine/tests/data cartesi/machine-emulator:tests /usr/share/cartesi-machine/tests/lua/create-machines.lua | |
| - name: Run cmio lua test scripts | |
| run: | | |
| docker run --rm -t -v cmio-templates:/tmp/cartesi-machine/tests/data cartesi/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-cmio.sh cartesi-jsonrpc-machine cartesi-machine lua | |
| - name: Run C API tests | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests test-machine-c-api | |
| - name: Run rv64ui test suite on microarchitecture | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests uarch-riscv-tests run | |
| - name: Run test suite with Microarchitecture | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests --jobs=$(nproc) run_uarch | |
| - name: Run test suite with microarchitecture and host based interpreters comparing machine hashes at every step | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests --concurrency=update_hash_tree:1 --test="^rv64ui.*$" --jobs=$(nproc) run_host_and_uarch | |
| - name: Create uarch json logs to be used to test the Solidity based microarchitecture interpreter | |
| run: | | |
| docker run --name uarch-logs -w /tmp -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/collect-uarch-test-logs.sh | |
| docker cp uarch-logs:/tmp/uarch-riscv-tests-json-logs.tar.gz . | |
| docker rm uarch-logs | |
| - name: Upload uarch json logs to be used to test the Solidity based microarchitecture interpreter | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: uarch-logs | |
| path: uarch-riscv-tests-json-logs.tar.gz | |
| compression-level: 0 | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| target: tests-debian-packager | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:tests-debian-packager | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Test microarchitecture interpreter | |
| run: | | |
| docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests-debian-packager make test-uarch-interpreter | |
| - name: Copy tests debian package | |
| run: make copy-tests-debian-packages | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: tests-amd64 | |
| path: | | |
| machine-emulator-tests_amd64.deb | |
| machine-emulator-tests-data.deb | |
| test_arm64: | |
| name: Test (linux/arm64) | |
| needs: build | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Download computation hash corpus | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: computation-hash-corpus | |
| - name: Extract computation hash corpus | |
| run: tar -xzf computation-hash-corpus.tar.gz | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| id: docker_build | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/arm64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/arm64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:devel | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| platforms: linux/arm64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:tests | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Simple boot inside the docker image | |
| run: docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine /bin/true | |
| - name: Verify computation hash corpus | |
| run: | | |
| docker run --platform linux/arm64 --rm -t -v ${{ github.workspace }}/computation-hash-corpus:/tmp/cartesi-machine/tests/data/computation-hash-corpus ${{ github.repository_owner }}/machine-emulator:tests lua5.4 /usr/share/cartesi-machine/tests/lua/test-computation-hash.lua | |
| - name: Run test suite inside the docker image | |
| run: docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine-tests run | |
| - name: Save and Load | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-save-and-load.sh | |
| - name: Yield and Save | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-yield-and-save.sh | |
| - name: Run test scripts | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/run-lua-tests.sh | |
| - name: Run jsonrpc lua test scripts | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-jsonrpc-server.sh cartesi-jsonrpc-machine cartesi-machine cartesi-machine-tests | |
| - name: Create cmio templates | |
| run: | | |
| docker run --platform linux/arm64 --rm -t -v cmio-templates:/tmp/cartesi-machine/tests/data cartesi/machine-emulator:tests /usr/share/cartesi-machine/tests/lua/create-machines.lua | |
| - name: Run cmio lua test scripts | |
| run: | | |
| docker run --platform linux/arm64 --rm -t -v cmio-templates:/tmp/cartesi-machine/tests/data cartesi/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-cmio.sh cartesi-jsonrpc-machine cartesi-machine lua | |
| - name: Run C API tests | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests test-machine-c-api | |
| - name: Run rv64ui test suite on microarchitecture | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests uarch-riscv-tests run | |
| - name: Run test suite with Microarchitecture | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests --jobs=$(nproc) run_uarch | |
| - name: Run test suite with microarchitecture and host based interpreters comparing machine hashes at every step | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests --test="^rv64ui%-v%-add.bin$" --concurrency=update_hash_tree:1 --jobs=$(nproc) run_host_and_uarch | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| target: tests-debian-packager | |
| platforms: linux/arm64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:tests-debian-packager | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Test microarchitecture interpreter | |
| run: | | |
| docker run --platform linux/arm64 --rm -t ${{ github.repository_owner }}/machine-emulator:tests-debian-packager make test-uarch-interpreter | |
| - name: Copy tests debian package | |
| run: make copy-tests-debian-packages BUILD_PLATFORM=linux/arm64 DEB_ARCH=arm64 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: tests-arm64 | |
| path: | | |
| machine-emulator-tests_arm64.deb | |
| lint: | |
| name: Lint | |
| needs: [check-format, check-commits] | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: toolchain | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:toolchain | |
| push: false | |
| load: true | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Lint (C++) | |
| run: | | |
| docker run --rm -t -v ${{ github.workspace }}:/usr/src/emulator ${{ github.repository_owner }}/machine-emulator:toolchain make -j$(nproc) lint | |
| - name: Lint (Lua) | |
| run: | | |
| docker run --rm -t -v ${{ github.workspace }}:/usr/src/emulator ${{ github.repository_owner }}/machine-emulator:toolchain make check-lua | |
| coverage: | |
| name: Coverage | |
| needs: build | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Download and extract computation hash corpus | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: computation-hash-corpus | |
| - name: Extract computation hash corpus | |
| run: tar -xzf computation-hash-corpus.tar.gz | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| id: docker_build | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| GIT_COMMIT=${GITHUB_SHA} | |
| DEBUG=yes | |
| COVERAGE=yes | |
| THREADS=no | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| target: tests-builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:coverage | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=yes | |
| COVERAGE=yes | |
| THREADS=no | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Run coverage | |
| run: | | |
| # coverage-all runs the parallel test group, then the pristine-swap uarch-pc | |
| # collection, then the report, sequenced by order-only prerequisites in the | |
| # Makefile (test-coverage-uarch-pcs relinks the emulator in place, so it must | |
| # not overlap any test; coverage-report reads every .gcda last). | |
| docker run --name coverage-report -t -v ${{ github.workspace }}/computation-hash-corpus:/usr/src/emulator/tests/build/computation-hash-corpus ${{ github.repository_owner }}/machine-emulator:coverage make -j$(nproc) coverage-all coverage=yes | |
| docker cp coverage-report:/usr/src/emulator/tests/build/coverage . | |
| docker rm coverage-report | |
| - name: Show coverage summary | |
| run: cat coverage/coverage.txt | |
| - name: Upload coverage detailed report | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: coverage-report | |
| path: coverage | |
| sanitize: | |
| name: Sanitize | |
| needs: build | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Download computation hash corpus | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: computation-hash-corpus | |
| - name: Extract computation hash corpus | |
| run: tar -xzf computation-hash-corpus.tar.gz | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build docker image | |
| id: docker_build | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=yes | |
| GIT_COMMIT=${GITHUB_SHA} | |
| SANITIZE=yes | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| target: tests-builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:sanitizer | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=yes | |
| SANITIZE=yes | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: MMAP rnd_bits workaround for the new GitHub Ubuntu runner | |
| run: sudo sysctl vm.mmap_rnd_bits=28 | |
| - name: Run tests with sanitizer | |
| run: | | |
| # test-parallel is the same concurrency-safe group the coverage job runs | |
| # (defined in tests/Makefile), minus the coverage-only tail steps. | |
| docker run --rm -t -v ${{ github.workspace }}/computation-hash-corpus:/usr/src/emulator/tests/build/computation-hash-corpus ${{ github.repository_owner }}/machine-emulator:sanitizer make -j$(nproc) sanitize=yes test-parallel | |
| docs: | |
| name: Docs | |
| needs: build | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| lfs: true | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Install e2tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends e2tools | |
| - name: Check rootfs-docs.ext2 is up to date | |
| run: make -C doc check-rootfs-docs | |
| - name: Ensure doc/recipes/rootfs-docs.licenses.md is tracked | |
| run: | | |
| if ! git ls-files --error-unmatch doc/recipes/rootfs-docs.licenses.md >/dev/null 2>&1; then | |
| echo "::error::doc/recipes/rootfs-docs.licenses.md is not tracked in git. The sync check requires a committed baseline to diff against. Generate it with 'make -C doc build-rootfs-docs-license' and commit the result." | |
| exit 1 | |
| fi | |
| - name: Build rootfs-docs license report | |
| run: make -C doc build-rootfs-docs-license | |
| - name: Check rootfs-docs.licenses.md matches committed version | |
| run: | | |
| if git diff --quiet doc/recipes/rootfs-docs.licenses.md; then | |
| exit 0 | |
| fi | |
| git --no-pager diff doc/recipes/rootfs-docs.licenses.md | |
| echo "::error::doc/recipes/rootfs-docs.licenses.md is out of sync with the generator. The diff above is what 'make -C doc build-rootfs-docs-license' produces vs the committed file. Check if changes were intended and, if so, regenerate locally and commit the result." | |
| exit 1 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build machine-emulator docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/amd64 | |
| tags: cartesi/machine-emulator:devel | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Ensure doc/README.md is tracked | |
| run: | | |
| if ! git ls-files --error-unmatch doc/README.md >/dev/null 2>&1; then | |
| echo "::error::doc/README.md is not tracked in git. The sync check requires a committed baseline to diff against. Generate it with 'make -C doc README.md' and commit the result." | |
| exit 1 | |
| fi | |
| - name: Build documentation | |
| run: make -C doc README.md EMULATOR_IMAGE_READY=yes | |
| - name: Check README.md matches committed version | |
| run: | | |
| if git diff --quiet doc/README.md; then | |
| exit 0 | |
| fi | |
| git --no-pager diff doc/README.md | |
| echo "::error::doc/README.md is out of sync with the generator. The diff above is what 'make -C doc README.md' produces vs the committed file. Check if changes were intended and, if so, regenerate locally and commit the result." | |
| exit 1 | |
| publish_artifacts: | |
| name: Publish artifacts | |
| needs: [build, lint, coverage, sanitize, test_amd64, test_arm64, risc0, docs] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup debian docker image tags | |
| id: docker_image_tags | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository_owner }}/machine-emulator | |
| docker.io/${{ github.repository_owner }}/machine-emulator,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}},enable=${{startsWith(github.ref, 'refs/tags/v')}} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build debian based docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.docker_image_tags.outputs.tags }} | |
| push: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Download artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| - name: Create generated files patch | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| run: | | |
| mv artifacts/cm-version.h src | |
| mv artifacts/interpret-jump-table.hpp src | |
| mv artifacts/uarch-pristine-ram.c uarch | |
| mv artifacts/uarch-pristine-hash.c uarch | |
| make create-generated-files-patch | |
| - name: Upload products to GitHub Release | |
| uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| with: | |
| draft: true | |
| files: | | |
| artifacts/machine-emulator_*.deb | |
| artifacts/uarch-ram.bin | |
| add-generated-files.diff | |
| uarch-logs/uarch-riscv-tests-json-logs.tar.gz | |
| tests-amd64/machine-emulator-tests-data.deb | |
| tests-amd64/machine-emulator-tests_*.deb | |
| tests-arm64/machine-emulator-tests_*.deb | |
| risc0-artifacts/cartesi-risc0-guest-step-prover.bin | |
| risc0-artifacts/cartesi-risc0-guest-step-prover-image-id.txt | |
| computation-hash-corpus/computation-hash-corpus.tar.gz | |
| risc0: | |
| name: RISC Zero | |
| needs: [check-format, check-commits] | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup variables | |
| run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Depot CLI | |
| uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1 | |
| - name: Build machine-emulator "builder" docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| target: builder | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:builder | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator docker image | |
| uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0 | |
| with: | |
| file: Dockerfile | |
| context: . | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:devel | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| GIT_COMMIT=${GITHUB_SHA} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| project: ${{ vars.DEPOT_PROJECT }} | |
| token: ${{ secrets.DEPOT_TOKEN }} | |
| - name: Build machine-emulator "tests" docker image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| file: tests/Dockerfile | |
| context: . | |
| platforms: linux/amd64 | |
| tags: ${{ github.repository_owner }}/machine-emulator:tests | |
| push: false | |
| load: true | |
| build-args: | | |
| DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }} | |
| MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | |
| - name: Simple boot inside the docker image | |
| run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine /bin/true | |
| - name: Create step log test files | |
| run: | | |
| mkdir -p /tmp/cartesi-machine/tests/data/step-logs | |
| chmod -R 777 /tmp/cartesi-machine/tests/data | |
| docker run --rm -t -v /tmp/cartesi-machine/tests/data:/tmp/cartesi-machine/tests/data ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine-tests --hash-function=sha256 --save-step-logs=/tmp/cartesi-machine/tests/data/step-logs run_step | |
| docker run --rm -t -v /tmp/cartesi-machine/tests/data:/tmp/cartesi-machine/tests/data ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/lua/create-step-logs.lua | |
| ls -l /tmp/cartesi-machine/tests/data/step-logs | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4 | |
| with: | |
| toolchain: stable | |
| - name: Install rzup | |
| run: | | |
| cargo install --locked --git https://github.com/risc0/risc0 rzup | |
| rzup install cargo-risczero 3.0.5 | |
| rzup install r0vm 3.0.5 | |
| rzup install cpp 2024.1.5 | |
| rzup install rust | |
| rzup show | |
| - name: Build interpret-jump-table.hpp | |
| run: docker run --rm -v .:/this-dir -t cartesi/machine-emulator:tests /this-dir/tools/gen-interpret-jump-table.lua > src/interpret-jump-table.hpp | |
| - name: Install lua5.4 | |
| run: sudo apt-get update && sudo apt-get install -y lua5.4 | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@8789b3e21e6c11b2697f5eb56eddae542f746c10 # v1.7.0 | |
| - name: Build risc0 prover/verifier | |
| run: make risc0 | |
| - name: Copy step log fixture for RISC0 tests | |
| run: | | |
| mkdir -p risc0/test/fixtures | |
| cp /tmp/cartesi-machine/tests/data/step-logs/step-0.log risc0/test/fixtures/step.log | |
| - name: Run risc0 tests | |
| run: CARTESI_STEP_LOGS_PATH=/tmp/cartesi-machine/tests/data/step-logs make test-risc0 | |
| - name: Export RISC0 artifacts | |
| run: make -C risc0 export-artifacts | |
| - name: Upload RISC0 artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: risc0-artifacts | |
| path: | | |
| risc0/artifacts/cartesi-risc0-guest-step-prover.bin | |
| risc0/artifacts/cartesi-risc0-guest-step-prover-image-id.txt | |
| risc0/artifacts/ImageID.sol |