|
| 1 | +name: 'Build' |
| 2 | +description: 'Builds solc executable.' |
| 3 | +inputs: |
| 4 | + release-suffix: |
| 5 | + description: 'Release suffix.' |
| 6 | + required: false |
| 7 | + default: '' |
| 8 | + zksync-version: |
| 9 | + description: 'Release version.' |
| 10 | + required: true |
| 11 | + solc-version: |
| 12 | + description: 'Solidity version.' |
| 13 | + required: true |
| 14 | + build-type: |
| 15 | + description: 'Build type: candidate or reference' |
| 16 | + required: false |
| 17 | + default: 'candidate' |
| 18 | + extra-args: |
| 19 | + description: 'Extra arguments for cmake.' |
| 20 | + required: false |
| 21 | + default: '' |
| 22 | +runs: |
| 23 | + using: "composite" |
| 24 | + steps: |
| 25 | + |
| 26 | + - name: Install Boost (MacOS ARM64) |
| 27 | + if: runner.os == 'macOS' |
| 28 | + shell: bash |
| 29 | + env: |
| 30 | + BOOST_DOWNLOAD_URL: "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source" |
| 31 | + BOOST_FILENAME: "boost_1_71_0" |
| 32 | + run: | |
| 33 | + curl -L -o ${BOOST_FILENAME}.tar.gz "${BOOST_DOWNLOAD_URL}/${BOOST_FILENAME}.tar.gz" |
| 34 | + tar xzf "${BOOST_FILENAME}.tar.gz" && cd ${BOOST_FILENAME} |
| 35 | + if [ ${RUNNER_ARCH} = ARM64 ]; then |
| 36 | + ./bootstrap.sh --prefix=${PWD}/boost |
| 37 | + else |
| 38 | + ./bootstrap.sh --prefix=/usr/local --with-python-version=2.7 |
| 39 | + fi |
| 40 | + ./b2 link=static runtime-link=static -j$(sysctl -n hw.ncpu) |
| 41 | + ./b2 install -j$(sysctl -n hw.ncpu) |
| 42 | +
|
| 43 | + - name: Build solc |
| 44 | + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} |
| 45 | + env: |
| 46 | + CXXFLAGS: "-Wno-narrowing" |
| 47 | + run: | |
| 48 | + mkdir -p ./build |
| 49 | + cd ./build |
| 50 | + [ ${RUNNER_OS} = macOS ] && PARALLEL=$(sysctl -n hw.ncpu) || PARALLEL=$(nproc) |
| 51 | + cmake .. \ |
| 52 | + -DCMAKE_BUILD_TYPE="Release" \ |
| 53 | + -DSOL_VERSION_ZKSYNC="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ |
| 54 | + -DSOLC_VERSION_ZKEVM="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ |
| 55 | + -DSOL_VERSION_ZKEVM="${{ inputs.solc-version }}-${{ inputs.zksync-version }}" \ |
| 56 | + -DUSE_Z3=OFF \ |
| 57 | + -DUSE_CVC4=OFF \ |
| 58 | + -DTESTS=0 \ |
| 59 | + -DBoost_NO_BOOST_CMAKE=TRUE \ |
| 60 | + -DSOLC_LINK_STATIC=1 \ |
| 61 | + -DSTATIC_LINKING=1 \ |
| 62 | + -DPEDANTIC=OFF ${{ inputs.extra-args}} |
| 63 | + if [[ ${{ inputs.solc-version}} == "0.4"* ]]; then |
| 64 | + cmake --build . --config Release --parallel ${PARALLEL} --target jsoncpp-project |
| 65 | + cmake --build . --config Release --parallel ${PARALLEL} --target range-v3-project |
| 66 | + fi |
| 67 | + cmake --build . --config Release --parallel ${PARALLEL} --target solc |
| 68 | + [ "$RUNNER_OS" = "Windows" ] && WIN_SUFFIX=".exe" |
| 69 | + cp ./solc/solc${WIN_SUFFIX} ./solc/solc-${{ inputs.solc-version }}-${{ inputs.build-type }}${WIN_SUFFIX} |
| 70 | +
|
| 71 | + - name: Upload binary for testing |
| 72 | + if: inputs.release-suffix == '' |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: solc-${{ inputs.solc-version }}-${{ inputs.build-type }} |
| 76 | + path: ./build/solc/solc-${{ inputs.solc-version }}-${{ inputs.build-type }} |
| 77 | + |
| 78 | + - name: Prepare binary |
| 79 | + if: inputs.release-suffix != '' |
| 80 | + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} |
| 81 | + run: | |
| 82 | + [ "$RUNNER_OS" = "Windows" ] && WIN_SUFFIX=".exe" |
| 83 | + SOLC_BIN="./build/solc/solc${WIN_SUFFIX}" |
| 84 | + mkdir -p ./releases/${{ inputs.release-suffix }} |
| 85 | + strip "${SOLC_BIN}" |
| 86 | + ${SOLC_BIN} --version |
| 87 | + mv ${SOLC_BIN} ./releases/${{ inputs.release-suffix }}/solc-${{ inputs.release-suffix }}-${{ inputs.solc-version}}-${{ inputs.zksync-version }}${WIN_SUFFIX} |
| 88 | +
|
| 89 | + - name: Upload binary for release |
| 90 | + if: inputs.release-suffix != '' |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: release-${{ inputs.release-suffix }} |
| 94 | + path: releases |
0 commit comments