diff --git a/.github/workflows/ci-all.yml b/.github/workflows/ci-all.yml new file mode 100644 index 000000000..a7a4480f9 --- /dev/null +++ b/.github/workflows/ci-all.yml @@ -0,0 +1,50 @@ +name: CI - All + +on: + push: + branches: ["main"] + paths: + - "host/**" + - "lib/**" + - "primitives/**" + - "script/**" + pull_request: + paths: + - "host/**" + - "lib/**" + - "primitives/**" + - "script/**" +env: + CARGO_TERM_COLOR: always + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-test-native: + uses: ./.github/workflows/ci-native.yml + + build-test-risc0: + uses: ./.github/workflows/ci-risc0.yml + + build-test-sp1: + uses: ./.github/workflows/ci-sp1.yml + + build-test-sgx-all: + uses: ./.github/workflows/ci-sgx-all.yml + + test-lib: + name: Test raiko-lib + runs-on: [taiko-runner] + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + + - run: cargo test -p raiko-lib --features=std diff --git a/.github/workflows/ci-build-test-reusable.yml b/.github/workflows/ci-build-test-reusable.yml new file mode 100644 index 000000000..6f706bea6 --- /dev/null +++ b/.github/workflows/ci-build-test-reusable.yml @@ -0,0 +1,56 @@ +name: CI Build and Test - Reusable + +on: + workflow_call: + inputs: + version_name: + type: string + required: true + version_toolchain: + type: string + required: true + +env: + CARGO_TERM_COLOR: always + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build-test: + name: Build and test + runs-on: [taiko-runner] + timeout-minutes: 120 + + env: + TARGET: ${{ inputs.version_name}} + CI: 1 + MOCK: 1 + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ inputs.version_toolchain }} + profile: minimal + + - name: Install cargo-binstall + uses: cargo-bins/cargo-binstall@v1.6.4 + + - name: Setup sccache + if: ${{ inputs.version_name }} == risc0 + uses: risc0/risc0/.github/actions/sccache@release-0.19 + + - name: Install ${{ inputs.version_name }} + run: make install + + - name: Build ${{ inputs.version_name }} prover + run: make build + + - name: Test ${{ inputs.version_name }} prover + run: make test + + - name: Build with tracer + if: ${{ inputs.version_name }} == native + run: cargo build -F tracer diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml new file mode 100644 index 000000000..6be18df08 --- /dev/null +++ b/.github/workflows/ci-lint.yml @@ -0,0 +1,40 @@ +name: CI - Lint + +on: + pull_request: + types: [opened, reopened, edited, synchronize] + +env: + CARGO_TERM_COLOR: always + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + clippy: + name: clippy + runs-on: [taiko-runner] + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - uses: risc0/risc0/.github/actions/rustup@release-0.19 + + - uses: risc0/risc0/.github/actions/sccache@release-0.19 + + - uses: risc0/clippy-action@main + with: + reporter: 'github-pr-check' + fail_on_error: true + clippy_flags: --workspace --all-targets --all-features -- -D warnings + + fmt: + name: fmt + runs-on: [taiko-runner] + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - uses: risc0/risc0/.github/actions/rustup@release-0.19 + + - run: make fmt diff --git a/.github/workflows/ci-native.yml b/.github/workflows/ci-native.yml new file mode 100644 index 000000000..4621e7226 --- /dev/null +++ b/.github/workflows/ci-native.yml @@ -0,0 +1,12 @@ +name: CI - Native + +on: workflow_call + + +jobs: + build-test-native: + name: Build and test native + uses: ./.github/workflows/ci-build-test-reusable.yml + with: + version_name: "native" + version_toolchain: "nightly-2024-04-17" diff --git a/.github/workflows/ci-provers.yml b/.github/workflows/ci-provers.yml new file mode 100644 index 000000000..5bf3f3e03 --- /dev/null +++ b/.github/workflows/ci-provers.yml @@ -0,0 +1,33 @@ +name: CI - All Provers + +on: + workflow_call: + push: + branches: ["main"] + paths: + - "pipelines/**" + - "harness/**" + pull_request: + paths: + - "pipelines/**" + - "harness/**" +env: + CARGO_TERM_COLOR: always + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-test-native: + uses: ./.github/workflows/ci-native.yml + + build-test-risc0: + uses: ./.github/workflows/ci-risc0.yml + + build-test-sp1: + uses: ./.github/workflows/ci-sp1.yml + + build-test-sgx-all: + uses: ./.github/workflows/ci-sgx-all.yml diff --git a/.github/workflows/ci-risc0.yml b/.github/workflows/ci-risc0.yml new file mode 100644 index 000000000..bc0d95f2f --- /dev/null +++ b/.github/workflows/ci-risc0.yml @@ -0,0 +1,20 @@ +name: CI - RISC0 + +on: + workflow_call: + push: + branches: ["main"] + paths: + - "provers/risc0/**" + pull_request: + paths: + - "provers/risc0/**" + + +jobs: + build-test-risc0: + name: Build and test risc0 + uses: ./.github/workflows/ci-build-test-reusable.yml + with: + version_name: "risc0" + version_toolchain: "stable" diff --git a/.github/workflows/ci-sgx-all.yml b/.github/workflows/ci-sgx-all.yml new file mode 100644 index 000000000..d08512cf8 --- /dev/null +++ b/.github/workflows/ci-sgx-all.yml @@ -0,0 +1,27 @@ +name: CI - SGX ALL + +on: + workflow_call: + push: + branches: ["main"] + paths: + - "provers/sgx/**" + pull_request: + paths: + - "provers/sgx/**" + +jobs: + build-test-sgx: + name: Build and test sgx + uses: ./.github/workflows/ci-build-test-reusable.yml + with: + version_name: "sgx" + version_toolchain: "stable" + + build-test-sgx-docker: + name: Build and test sgx with Docker + uses: ./.github/workflows/ci-sgx-docker.yml + + build-test-sgx-hardware: + name: Build and test sgx in hardware + uses: ./.github/workflows/ci-sgx-hardware.yml diff --git a/.github/workflows/ci-sgx-docker.yml b/.github/workflows/ci-sgx-docker.yml new file mode 100644 index 000000000..0299738d6 --- /dev/null +++ b/.github/workflows/ci-sgx-docker.yml @@ -0,0 +1,25 @@ +name: CI - SGX Docker + +on: + workflow_call: + push: + branches: ["main"] + paths: + - "docker/**" + pull_request: + paths: + - "docker/**" + +jobs: + build-test-sgx-with-docker: + name: Build and test sgx with Docker + runs-on: [taiko-runner] + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + - name: Setup and build + run: | + cd docker + docker compose build --no-cache + shell: bash diff --git a/.github/workflows/ci-sgx-hardware.yml b/.github/workflows/ci-sgx-hardware.yml new file mode 100644 index 000000000..53c648d8b --- /dev/null +++ b/.github/workflows/ci-sgx-hardware.yml @@ -0,0 +1,35 @@ +name: CI - SGX Hardware + +on: workflow_call + +jobs: + build-test-sgx-hardware: + name: Build and test sgx in hardware + runs-on: [self-hosted, sgx, linux] + timeout-minutes: 120 + env: + TARGET: sgx + CI: 1 + EDMM: 0 + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Install cargo-binstall + uses: cargo-bins/cargo-binstall@v1.6.4 + + - name: Install sgx + run: make install + + - name: Build sgx prover + run: make build + + - name: Test sgx prover + run: make test diff --git a/.github/workflows/ci-sp1.yml b/.github/workflows/ci-sp1.yml new file mode 100644 index 000000000..6c0654b98 --- /dev/null +++ b/.github/workflows/ci-sp1.yml @@ -0,0 +1,19 @@ +name: CI - SP1 + +on: + workflow_call: + push: + branches: ["main"] + paths: + - "provers/sp1/**" + pull_request: + paths: + - "provers/sp1/**" + +jobs: + build-test-sgx: + name: Build and test sp1 + uses: ./.github/workflows/ci-build-test-reusable.yml + with: + version_name: "sp1" + version_toolchain: "nightly-2024-04-18" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 040a6af53..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: CI - -on: - push: - branches: ["main"] - pull_request: - -env: - CARGO_TERM_COLOR: always - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build-test: - name: Build and test - runs-on: [taiko-runner] - timeout-minutes: 120 - strategy: - matrix: - VERSIONS: [ - {name: native, toolchain: nightly-2024-04-17}, - {name: sp1, toolchain: nightly-2024-04-17}, - {name: risc0, toolchain: stable}, - {name: sgx, toolchain: stable}, - ] - env: - TARGET: ${{ matrix.VERSIONS.name }} - CI: 1 - MOCK: 1 - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.VERSIONS.toolchain }} - profile: minimal - - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.6.4 - - - name: Setup sccache - if: ${{ matrix.VERSIONS.name }} == risc0 - uses: risc0/risc0/.github/actions/sccache@release-0.19 - - - name: Install ${{ matrix.VERSIONS.name }} - run: make install - - - name: Build ${{ matrix.VERSIONS.name }} prover - run: make build - - - name: Test ${{ matrix.VERSIONS.name }} prover - run: make test - - - name: Build with tracer - if: ${{ matrix.VERSIONS.name }} == native - run: cargo build -F tracer - - build-test-sgx-hardware: - name: Build and test sgx in hardware - runs-on: [self-hosted, sgx, linux] - timeout-minutes: 120 - env: - TARGET: sgx - CI: 1 - EDMM: 0 - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.6.4 - - - name: Install sgx - run: make install - - - name: Build sgx prover - run: make build - - - name: Test sgx prover - run: make test - - build-test-sgx-with-docker: - name: Build and test sgx with Docker - runs-on: [taiko-runner] - timeout-minutes: 60 - - steps: - - uses: actions/checkout@v4 - - name: Setup and build - run: | - cd docker - docker compose build --no-cache - shell: bash - - test-lib: - name: Test raiko-lib - runs-on: [taiko-runner] - timeout-minutes: 60 - - steps: - - uses: actions/checkout@v4 - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - - - run: cargo test -p raiko-lib --features=std - - clippy: - name: clippy - runs-on: [taiko-runner] - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v4 - - - uses: risc0/risc0/.github/actions/rustup@release-0.19 - - - uses: risc0/risc0/.github/actions/sccache@release-0.19 - - - uses: risc0/clippy-action@main - with: - reporter: 'github-pr-check' - fail_on_error: true - clippy_flags: --workspace --all-targets --all-features -- -D warnings - - fmt: - name: fmt - runs-on: [taiko-runner] - timeout-minutes: 10 - - steps: - - uses: actions/checkout@v4 - - - uses: risc0/risc0/.github/actions/rustup@release-0.19 - - - run: make fmt