|  | 
|  | 1 | +version: 2.1 | 
|  | 2 | + | 
|  | 3 | +parameters: | 
|  | 4 | +  ci_builder_image: | 
|  | 5 | +    type: string | 
|  | 6 | +    # depends with rvsol/lib/optimism submodule version | 
|  | 7 | +    default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.46.1 | 
|  | 8 | + | 
|  | 9 | +workflows: | 
|  | 10 | +  main: | 
|  | 11 | +    jobs: | 
|  | 12 | +      - pnpm-monorepo | 
|  | 13 | +      - go-mod-download-monorepo | 
|  | 14 | +      - go-mod-download-asterisc | 
|  | 15 | +      - op-program-riscv: | 
|  | 16 | +          requires: ["go-mod-download-monorepo"] | 
|  | 17 | +      - asterisc-prestate: | 
|  | 18 | +          requires: ["go-mod-download-asterisc", "op-program-riscv", "pnpm-monorepo"] | 
|  | 19 | + | 
|  | 20 | +jobs: | 
|  | 21 | +  pnpm-monorepo: | 
|  | 22 | +    docker: | 
|  | 23 | +      - image: <<pipeline.parameters.ci_builder_image>> | 
|  | 24 | +    resource_class: xlarge | 
|  | 25 | +    steps: | 
|  | 26 | +      - checkout | 
|  | 27 | +      - run: | 
|  | 28 | +          name: Fetch submodules for asterisc | 
|  | 29 | +          # This will also fetch monorepo's submodule. | 
|  | 30 | +          # Therefore we do not have to call `make submodules` at monorepo root | 
|  | 31 | +          command: git submodule update --init --recursive | 
|  | 32 | +      - run: | 
|  | 33 | +          name: Check L1 geth version | 
|  | 34 | +          command: ./ops/scripts/geth-version-checker.sh || (echo "geth version is wrong, update ci-builder"; false) | 
|  | 35 | +          working_directory: rvsol/lib/optimism | 
|  | 36 | +      - restore_cache: | 
|  | 37 | +          name: Restore PNPM Package Cache | 
|  | 38 | +          keys: | 
|  | 39 | +            - pnpm-packages-v2-{{ checksum "rvsol/lib/optimism/pnpm-lock.yaml" }} | 
|  | 40 | +      - restore_cache: | 
|  | 41 | +          name: Restore Go modules cache for monorepo | 
|  | 42 | +          # this go mod cache will be populated from go-mod-download-monorepo step | 
|  | 43 | +          key: gomod-{{ checksum "rvsol/lib/optimism/go.sum" }} | 
|  | 44 | +      # Fetch node_modules into the pnpm store | 
|  | 45 | +      # This will cache node_modules based on pnpm-lock so other steps can instantly install them with `pnpm install --prefer-offline` | 
|  | 46 | +      # --prefer-offline installs node_modules instantly by just reading from cache if it exists rather than fetching from network | 
|  | 47 | +      # when installing node_modules pnpm simply adds symlinks instead of copying the files which is why it is pretty much instant to run --prefer-offline | 
|  | 48 | +      # this allows a caching strategy of only checking pnpm-lockfile so we don't have to keep it in sync with our packages | 
|  | 49 | +      # For more information see https://pnpm.io/cli/fetch | 
|  | 50 | +      - run: | 
|  | 51 | +          name: Fetch dependencies | 
|  | 52 | +          command: pnpm fetch --frozen-lockfile --prefer-offline | 
|  | 53 | +          working_directory: rvsol/lib/optimism | 
|  | 54 | +      - save_cache: | 
|  | 55 | +          name: Save PNPM Package Cache | 
|  | 56 | +          key: pnpm-packages-v2-{{ checksum "rvsol/lib/optimism/pnpm-lock.yaml" }} | 
|  | 57 | +          paths: | 
|  | 58 | +            - "rvsol/lib/optimism/node_modules" | 
|  | 59 | +      - run: | 
|  | 60 | +          name: Install dependencies | 
|  | 61 | +          command: pnpm install:ci:offline | 
|  | 62 | +          working_directory: rvsol/lib/optimism | 
|  | 63 | +      - run: | 
|  | 64 | +          name: print forge version | 
|  | 65 | +          command: forge --version | 
|  | 66 | +          working_directory: rvsol/lib/optimism | 
|  | 67 | +      - run: | 
|  | 68 | +          name: Build monorepo | 
|  | 69 | +          environment: | 
|  | 70 | +            FOUNDRY_PROFILE: ci | 
|  | 71 | +          command: pnpm build | 
|  | 72 | +          working_directory: rvsol/lib/optimism | 
|  | 73 | +      - run: | 
|  | 74 | +          name: Generate FPAC allocs | 
|  | 75 | +          command: DEVNET_FPAC="true" make devnet-allocs | 
|  | 76 | +          working_directory: rvsol/lib/optimism | 
|  | 77 | +      - run: | 
|  | 78 | +          name: Copy FPAC allocs to .devnet-fpac | 
|  | 79 | +          command: cp -r .devnet/ .devnet-fault-proofs/ | 
|  | 80 | +          working_directory: rvsol/lib/optimism | 
|  | 81 | +      - persist_to_workspace: | 
|  | 82 | +          root: rvsol/lib/optimism | 
|  | 83 | +          paths: | 
|  | 84 | +            - "packages/**/dist" | 
|  | 85 | +            - "packages/contracts-bedrock/cache" | 
|  | 86 | +            - "packages/contracts-bedrock/artifacts" | 
|  | 87 | +            - "packages/contracts-bedrock/forge-artifacts" | 
|  | 88 | +            - "packages/contracts-bedrock/tsconfig.tsbuildinfo" | 
|  | 89 | +            - "packages/contracts-bedrock/tsconfig.build.tsbuildinfo" | 
|  | 90 | +            - ".devnet-fault-proofs/allocs-l1.json" | 
|  | 91 | +            - ".devnet-fault-proofs/addresses.json" | 
|  | 92 | +            - "packages/contracts-bedrock/deploy-config/devnetL1.json" | 
|  | 93 | +            - "packages/contracts-bedrock/deployments/devnetL1" | 
|  | 94 | + | 
|  | 95 | +  go-mod-download-monorepo: | 
|  | 96 | +    docker: | 
|  | 97 | +      - image: <<pipeline.parameters.ci_builder_image>> | 
|  | 98 | +    parameters: | 
|  | 99 | +      file: | 
|  | 100 | +        default: rvsol/lib/optimism/go.sum | 
|  | 101 | +        description: The file name of checksum for restore_cache and save_cache. | 
|  | 102 | +        type: string | 
|  | 103 | +      key: | 
|  | 104 | +        default: gomod | 
|  | 105 | +        description: The key of restore_cache and save_cache. | 
|  | 106 | +        type: string | 
|  | 107 | +    steps: | 
|  | 108 | +      - checkout | 
|  | 109 | +      - run: | 
|  | 110 | +          name: Fetch submodules for asterisc | 
|  | 111 | +          command: git submodule update --init --recursive | 
|  | 112 | +      - restore_cache: | 
|  | 113 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 114 | +          name: Restore Go modules cache | 
|  | 115 | +      - run: | 
|  | 116 | +          name: Sanity check go mod cache path | 
|  | 117 | +          command: test "$(go env GOMODCACHE)" == "/go/pkg/mod" # yes, it's an odd path | 
|  | 118 | +          working_directory: rvsol/lib/optimism | 
|  | 119 | +      - run: | 
|  | 120 | +          command: go mod download | 
|  | 121 | +          name: Download Go module dependencies | 
|  | 122 | +          working_directory: rvsol/lib/optimism | 
|  | 123 | +      - run: | 
|  | 124 | +          name: Go mod tidy | 
|  | 125 | +          command: make mod-tidy && git diff --exit-code | 
|  | 126 | +          working_directory: rvsol/lib/optimism | 
|  | 127 | +      - run: | 
|  | 128 | +          name: run Go linter | 
|  | 129 | +          command: | | 
|  | 130 | +            # Identify how many cores it defaults to | 
|  | 131 | +            golangci-lint --help | grep concurrency | 
|  | 132 | +            make lint-go | 
|  | 133 | +          working_directory: rvsol/lib/optimism | 
|  | 134 | +      - save_cache: | 
|  | 135 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 136 | +          name: Save Go modules cache | 
|  | 137 | +          paths: | 
|  | 138 | +            - "/go/pkg/mod" | 
|  | 139 | + | 
|  | 140 | +  go-mod-download-asterisc: | 
|  | 141 | +    docker: | 
|  | 142 | +      - image: <<pipeline.parameters.ci_builder_image>> | 
|  | 143 | +    parameters: | 
|  | 144 | +      file: | 
|  | 145 | +        default: go.sum | 
|  | 146 | +        description: The file name of checksum for restore_cache and save_cache. | 
|  | 147 | +        type: string | 
|  | 148 | +      key: | 
|  | 149 | +        default: gomod | 
|  | 150 | +        description: The key of restore_cache and save_cache. | 
|  | 151 | +        type: string | 
|  | 152 | +    steps: | 
|  | 153 | +      - checkout | 
|  | 154 | +      - restore_cache: | 
|  | 155 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 156 | +          name: Restore Go modules cache | 
|  | 157 | +      - run: | 
|  | 158 | +          name: Sanity check go mod cache path | 
|  | 159 | +          command: test "$(go env GOMODCACHE)" == "/go/pkg/mod" # yes, it's an odd path | 
|  | 160 | +      - run: | 
|  | 161 | +          command: go mod download | 
|  | 162 | +          name: Download Go module dependencies | 
|  | 163 | +      - save_cache: | 
|  | 164 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 165 | +          name: Save Go modules cache | 
|  | 166 | +          paths: | 
|  | 167 | +            - "/go/pkg/mod" | 
|  | 168 | + | 
|  | 169 | +  op-program-riscv: | 
|  | 170 | +    docker: | 
|  | 171 | +      - image: <<pipeline.parameters.ci_builder_image>> | 
|  | 172 | +    parameters: | 
|  | 173 | +      file: | 
|  | 174 | +        default: rvsol/lib/optimism/go.sum | 
|  | 175 | +        description: The file name of checksum for restore_cache and save_cache. | 
|  | 176 | +        type: string | 
|  | 177 | +      key: | 
|  | 178 | +        default: gomod | 
|  | 179 | +        description: The key of restore_cache and save_cache. | 
|  | 180 | +        type: string | 
|  | 181 | +    steps: | 
|  | 182 | +      - checkout | 
|  | 183 | +      - run: | 
|  | 184 | +          name: Fetch submodules for asterisc | 
|  | 185 | +          command: git submodule update --init --recursive | 
|  | 186 | +      - restore_cache: | 
|  | 187 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 188 | +          name: Restore Go modules cache | 
|  | 189 | +      - run: | 
|  | 190 | +          name: Build op-program-client-riscv | 
|  | 191 | +          command: make op-program-client-riscv | 
|  | 192 | +          working_directory: rvsol/lib/optimism/op-program | 
|  | 193 | +      - run: | 
|  | 194 | +          name: Copy op-program-client-riscv to op-program-artifacts | 
|  | 195 | +          command: cp -r bin op-program-artifacts | 
|  | 196 | +          working_directory: rvsol/lib/optimism/op-program | 
|  | 197 | +      - persist_to_workspace: | 
|  | 198 | +          root: rvsol/lib/optimism/op-program | 
|  | 199 | +          paths: | 
|  | 200 | +            - "op-program-artifacts" | 
|  | 201 | + | 
|  | 202 | +  asterisc-prestate: | 
|  | 203 | +    docker: | 
|  | 204 | +      - image: <<pipeline.parameters.ci_builder_image>> | 
|  | 205 | +    parameters: | 
|  | 206 | +      file: | 
|  | 207 | +        default: go.sum | 
|  | 208 | +        description: The file name of checksum for restore_cache and save_cache. | 
|  | 209 | +        type: string | 
|  | 210 | +      key: | 
|  | 211 | +        default: gomod | 
|  | 212 | +        description: The key of restore_cache and save_cache. | 
|  | 213 | +        type: string | 
|  | 214 | +    steps: | 
|  | 215 | +      - checkout | 
|  | 216 | +      - attach_workspace: | 
|  | 217 | +          at: /tmp/workspace | 
|  | 218 | +      - restore_cache: | 
|  | 219 | +          key: << parameters.key >>-{{ checksum "<< parameters.file >>" }} | 
|  | 220 | +          name: Restore Go modules cache | 
|  | 221 | +      - run: | 
|  | 222 | +          name: Load op-program-client-riscv | 
|  | 223 | +          command: | | 
|  | 224 | +            cp /tmp/workspace/op-program-artifacts/op-program-client-riscv.elf op-program-client-riscv.elf | 
|  | 225 | +      - run: | 
|  | 226 | +          name: Build Asterisc binary and contract | 
|  | 227 | +          command: make build | 
|  | 228 | +      - run: | 
|  | 229 | +          name: Generate asterisc prestate | 
|  | 230 | +          command: OP_PROGRAM_PATH=./op-program-client-riscv.elf make prestate | 
|  | 231 | +      - run: | 
|  | 232 | +          name: Copy asterisc artifacts to asterisc-artifacts | 
|  | 233 | +          command: cp -r rvgo/bin asterisc-artifacts | 
|  | 234 | +      - persist_to_workspace: | 
|  | 235 | +          root: . | 
|  | 236 | +          paths:  | 
|  | 237 | +            - "asterisc-artifacts" | 
|  | 238 | +       | 
0 commit comments