|
| 1 | +# Reusable workflow for building all binaries |
| 2 | +# This workflow is called by other workflows to build reth, geth, rbuilder, op-program, and contracts |
| 3 | +name: Build Binaries |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + reth_version: |
| 9 | + description: "Reth version to build" |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + default: "27a8c0f5a6dfb27dea84c5751776ecabdd069646" |
| 13 | + geth_version: |
| 14 | + description: "Geth version to build" |
| 15 | + required: false |
| 16 | + type: string |
| 17 | + default: "6cbfcd5161083bcd4052edc3022d9f99c6fe40e0" |
| 18 | + rbuilder_version: |
| 19 | + description: "Rbuilder version to build" |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + default: "23f42c8e78ba3abb45a8840df7037a27e196e601" |
| 23 | + |
| 24 | +# Set minimal permissions for all jobs by default |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + build-contracts: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + actions: write # Required for artifact upload |
| 34 | + steps: |
| 35 | + - name: Harden the runner (Audit all outbound calls) |
| 36 | + uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
| 37 | + with: |
| 38 | + egress-policy: audit |
| 39 | + |
| 40 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 41 | + |
| 42 | + - name: Install Foundry |
| 43 | + uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0 |
| 44 | + - name: Cache Forge artifacts |
| 45 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3 |
| 46 | + with: |
| 47 | + path: | |
| 48 | + contracts/out |
| 49 | + contracts/cache |
| 50 | + key: ${{ runner.os }}-forge-${{ hashFiles('**/foundry.toml', '**/*.sol') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-forge- |
| 53 | +
|
| 54 | + - name: Build Contracts |
| 55 | + run: | |
| 56 | + forge build --force |
| 57 | +
|
| 58 | + - name: Upload contract artifacts |
| 59 | + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 |
| 60 | + with: |
| 61 | + name: contracts |
| 62 | + path: contracts/out/ |
| 63 | + retention-days: 1 |
| 64 | + |
| 65 | + build-reth: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + permissions: |
| 68 | + contents: read |
| 69 | + actions: write # Required for artifact upload |
| 70 | + steps: |
| 71 | + - name: Harden the runner (Audit all outbound calls) |
| 72 | + uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
| 73 | + with: |
| 74 | + egress-policy: audit |
| 75 | + |
| 76 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 77 | + |
| 78 | + - name: Set up Rust |
| 79 | + uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0 |
| 80 | + |
| 81 | + - name: Cache reth binary |
| 82 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3 |
| 83 | + id: cache-reth |
| 84 | + with: |
| 85 | + path: ~/bin/reth |
| 86 | + key: ${{ runner.os }}-reth-${{ inputs.reth_version }} |
| 87 | + |
| 88 | + - name: Build reth |
| 89 | + if: steps.cache-reth.outputs.cache-hit != 'true' |
| 90 | + run: | |
| 91 | + unset CI |
| 92 | + mkdir -p ~/bin |
| 93 | + cd clients |
| 94 | + RETH_VERSION=${{ inputs.reth_version }} OUTPUT_DIR=~/bin ./build-reth.sh |
| 95 | + # Rename op-reth to reth for consistency |
| 96 | + [ -f ~/bin/op-reth ] && mv ~/bin/op-reth ~/bin/reth || true |
| 97 | +
|
| 98 | + - name: Upload reth artifact |
| 99 | + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 |
| 100 | + with: |
| 101 | + name: reth |
| 102 | + path: ~/bin/reth |
| 103 | + retention-days: 1 |
| 104 | + |
| 105 | + build-geth: |
| 106 | + runs-on: ubuntu-latest |
| 107 | + permissions: |
| 108 | + contents: read |
| 109 | + actions: write # Required for artifact upload |
| 110 | + steps: |
| 111 | + - name: Harden the runner (Audit all outbound calls) |
| 112 | + uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
| 113 | + with: |
| 114 | + egress-policy: audit |
| 115 | + |
| 116 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 117 | + |
| 118 | + - name: Set up Go |
| 119 | + uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 |
| 120 | + |
| 121 | + - name: Cache geth binary |
| 122 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3 |
| 123 | + id: cache-geth |
| 124 | + with: |
| 125 | + path: ~/bin/geth |
| 126 | + key: ${{ runner.os }}-geth-${{ inputs.geth_version }} |
| 127 | + |
| 128 | + - name: Build geth |
| 129 | + if: steps.cache-geth.outputs.cache-hit != 'true' |
| 130 | + run: | |
| 131 | + unset CI |
| 132 | + mkdir -p ~/bin |
| 133 | + cd clients |
| 134 | + GETH_VERSION=${{ inputs.geth_version }} OUTPUT_DIR=~/bin ./build-geth.sh |
| 135 | +
|
| 136 | + - name: Upload geth artifact |
| 137 | + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 |
| 138 | + with: |
| 139 | + name: geth |
| 140 | + path: ~/bin/geth |
| 141 | + retention-days: 1 |
| 142 | + |
| 143 | + build-rbuilder: |
| 144 | + runs-on: ubuntu-latest |
| 145 | + permissions: |
| 146 | + contents: read |
| 147 | + actions: write # Required for artifact upload |
| 148 | + steps: |
| 149 | + - name: Harden the runner (Audit all outbound calls) |
| 150 | + uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
| 151 | + with: |
| 152 | + egress-policy: audit |
| 153 | + |
| 154 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 155 | + |
| 156 | + - name: Set up Rust |
| 157 | + uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0 |
| 158 | + |
| 159 | + - name: Cache rbuilder binary |
| 160 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3 |
| 161 | + id: cache-rbuilder |
| 162 | + with: |
| 163 | + path: ~/bin/rbuilder |
| 164 | + key: ${{ runner.os }}-rbuilder-${{ inputs.rbuilder_version }} |
| 165 | + |
| 166 | + - name: Build rbuilder |
| 167 | + if: steps.cache-rbuilder.outputs.cache-hit != 'true' |
| 168 | + run: | |
| 169 | + unset CI |
| 170 | + mkdir -p ~/bin |
| 171 | + cd clients |
| 172 | + RBUILDER_VERSION=${{ inputs.rbuilder_version }} OUTPUT_DIR=~/bin ./build-rbuilder.sh |
| 173 | + # Rename op-rbuilder to rbuilder for consistency |
| 174 | + [ -f ~/bin/op-rbuilder ] && mv ~/bin/op-rbuilder ~/bin/rbuilder || true |
| 175 | +
|
| 176 | + - name: Upload rbuilder artifact |
| 177 | + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 |
| 178 | + with: |
| 179 | + name: rbuilder |
| 180 | + path: ~/bin/rbuilder |
| 181 | + retention-days: 1 |
| 182 | + |
| 183 | + build-op-program: |
| 184 | + runs-on: ubuntu-latest |
| 185 | + permissions: |
| 186 | + contents: read |
| 187 | + actions: write # Required for artifact upload |
| 188 | + steps: |
| 189 | + - name: Harden the runner (Audit all outbound calls) |
| 190 | + uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1 |
| 191 | + with: |
| 192 | + egress-policy: audit |
| 193 | + |
| 194 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 195 | + |
| 196 | + - name: Cache op-program binary |
| 197 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3 |
| 198 | + id: cache-op-program |
| 199 | + with: |
| 200 | + path: op-program/versions/v1.6.1-rc.1/op-program |
| 201 | + key: ${{ runner.os }}-op-program-${{ hashFiles('op-program/**') }} |
| 202 | + |
| 203 | + - name: Build op-program |
| 204 | + if: steps.cache-op-program.outputs.cache-hit != 'true' |
| 205 | + run: | |
| 206 | + curl https://mise.run | sh |
| 207 | + pushd op-program |
| 208 | + mise x -- ./build.sh |
| 209 | + popd |
| 210 | +
|
| 211 | + - name: Upload op-program artifact |
| 212 | + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 |
| 213 | + with: |
| 214 | + name: op-program |
| 215 | + path: op-program/versions/v1.6.1-rc.1/op-program |
| 216 | + retention-days: 1 |
0 commit comments