|
| 1 | +name: Create release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + tags: |
| 7 | + - "v*.*.*" |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + create_release: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ ubuntu-22.04 ] |
| 17 | + |
| 18 | + python-version: [ 3.11 ] |
| 19 | + node-version: [ 18.16.0 ] |
| 20 | + |
| 21 | + ganache-version: [ 7.8.0 ] |
| 22 | + |
| 23 | + solc-version: [ v0.8.20 ] |
| 24 | + |
| 25 | + env: |
| 26 | + SOLC_BIN: ${{ github.workspace }}/build/solc-static-linux |
| 27 | + SOLC_FLAGS: >- |
| 28 | + --optimize --optimize-runs 200 |
| 29 | + --revert-strings strip |
| 30 | + --via-ir |
| 31 | + --overwrite |
| 32 | + --base-path ${{ github.workspace }} |
| 33 | + --output-dir ${{ github.workspace }}/build/ |
| 34 | + SOLC_VER_CMD: >- |
| 35 | + ${{ github.workspace }}/build/solc-static-linux |
| 36 | + --version | tail -n 1 | sed -e "s/^Version: //g" |
| 37 | + RELE_NOTE: ${{ github.workspace }}/build/release_note.md |
| 38 | + |
| 39 | + name: A job to create a release |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + submodules: recursive |
| 45 | + |
| 46 | + - name: Installing Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v4 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + |
| 51 | + - name: Installing Python packages |
| 52 | + run: | |
| 53 | + python3 -m pip install --requirement ${{ github.workspace }}/utils/gas_cost_eval_requirements.txt |
| 54 | +
|
| 55 | + - name: Installing Node ${{ matrix.node-version }} |
| 56 | + uses: actions/setup-node@v3 |
| 57 | + with: |
| 58 | + node-version: ${{ matrix.node-version }} |
| 59 | + |
| 60 | + - name: Installing NPM packages |
| 61 | + run: | |
| 62 | + npm install -g ganache@${{ matrix.ganache-version }} |
| 63 | +
|
| 64 | + - name: Installing Solc compiler |
| 65 | + run: | |
| 66 | + mkdir -p ${{ github.workspace }}/build/ |
| 67 | + curl -fsSL -o ${SOLC_BIN} \ |
| 68 | + https://github.com/ethereum/solidity/releases/download/${{ matrix.solc-version }}/solc-static-linux |
| 69 | + chmod +x ${SOLC_BIN} |
| 70 | +
|
| 71 | + - name: Compiling contracts for contracts/IASRootCertMgr.sol |
| 72 | + run: | |
| 73 | + ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/contracts/IASRootCertMgr.sol |
| 74 | + ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/contracts/IASRootCertMgr.sol |
| 75 | +
|
| 76 | + - name: Compiling contracts for contracts/IASReportCertMgr.sol |
| 77 | + run: | |
| 78 | + ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/contracts/IASReportCertMgr.sol |
| 79 | + ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/contracts/IASReportCertMgr.sol |
| 80 | +
|
| 81 | + - name: Compiling contracts for contracts/DecentServerCertMgr.sol |
| 82 | + run: | |
| 83 | + ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/contracts/DecentServerCertMgr.sol |
| 84 | + ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/contracts/DecentServerCertMgr.sol |
| 85 | +
|
| 86 | + - name: Compiling contracts for tests/HelloWorldApp.sol |
| 87 | + run: | |
| 88 | + ${SOLC_BIN} ${SOLC_FLAGS} --bin ${{ github.workspace }}/tests/HelloWorldApp.sol |
| 89 | + ${SOLC_BIN} ${SOLC_FLAGS} --abi ${{ github.workspace }}/tests/HelloWorldApp.sol |
| 90 | +
|
| 91 | + - name: Prepare binaries for gas cost evaluation |
| 92 | + working-directory: ${{ github.workspace }}/build |
| 93 | + run: | |
| 94 | + mkdir -p contracts |
| 95 | + cp IASRootCertMgr.bin contracts/IASRootCertMgr.bin |
| 96 | + cp IASRootCertMgr.abi contracts/IASRootCertMgr.abi |
| 97 | + cp IASReportCertMgr.bin contracts/IASReportCertMgr.bin |
| 98 | + cp IASReportCertMgr.abi contracts/IASReportCertMgr.abi |
| 99 | + cp DecentServerCertMgr.bin contracts/DecentServerCertMgr.bin |
| 100 | + cp DecentServerCertMgr.abi contracts/DecentServerCertMgr.abi |
| 101 | + mkdir -p tests |
| 102 | + cp HelloWorldApp.bin tests/HelloWorldApp.bin |
| 103 | + cp HelloWorldApp.abi tests/HelloWorldApp.abi |
| 104 | +
|
| 105 | + - name: Run gas cost evaluation |
| 106 | + run: | |
| 107 | + python3 ${{ github.workspace }}/utils/GanacheContractTests.py eval |
| 108 | +
|
| 109 | + - name: Calculating checksums of the binary |
| 110 | + working-directory: ${{ github.workspace }}/build |
| 111 | + run: | |
| 112 | + sha256sum solc-static-linux >> checksums.txt |
| 113 | + sha256sum IASRootCertMgr.bin >> checksums.txt |
| 114 | + sha256sum IASRootCertMgr.abi >> checksums.txt |
| 115 | + sha256sum IASReportCertMgr.bin >> checksums.txt |
| 116 | + sha256sum IASReportCertMgr.abi >> checksums.txt |
| 117 | + sha256sum DecentServerCertMgr.bin >> checksums.txt |
| 118 | + sha256sum DecentServerCertMgr.abi >> checksums.txt |
| 119 | + sha256sum HelloWorldApp.bin >> checksums.txt |
| 120 | + sha256sum HelloWorldApp.abi >> checksums.txt |
| 121 | +
|
| 122 | + - name: Generate release note |
| 123 | + working-directory: ${{ github.workspace }}/build |
| 124 | + run: | |
| 125 | + echo "# Release note" >> ${RELE_NOTE} |
| 126 | + echo "" >> ${RELE_NOTE} |
| 127 | + echo "## Contracts" >> ${RELE_NOTE} |
| 128 | + echo "- contracts/IASRootCertMgr.sol" >> ${RELE_NOTE} |
| 129 | + echo "- contracts/IASReportCertMgr.sol" >> ${RELE_NOTE} |
| 130 | + echo "- contracts/DecentServerCertMgr.sol" >> ${RELE_NOTE} |
| 131 | + echo "- tests/HelloWorldApp.sol" >> ${RELE_NOTE} |
| 132 | + echo "" >> ${RELE_NOTE} |
| 133 | + echo "## Build configurations" >> ${RELE_NOTE} |
| 134 | + echo "- OS: \`${{ matrix.os }}\`" >> ${RELE_NOTE} |
| 135 | + echo "- Solc version: \`$(bash -c "${SOLC_VER_CMD}")\`" >> ${RELE_NOTE} |
| 136 | + echo "- Compiler Flags: \`${SOLC_FLAGS}\`" >> ${RELE_NOTE} |
| 137 | + echo "" >> ${RELE_NOTE} |
| 138 | + echo "## Checksums" >> ${RELE_NOTE} |
| 139 | + echo "\`\`\`" >> ${RELE_NOTE} |
| 140 | + cat checksums.txt >> ${RELE_NOTE} |
| 141 | + echo "\`\`\`" >> ${RELE_NOTE} |
| 142 | + echo "" >> ${RELE_NOTE} |
| 143 | + echo "## Gas Cost Evaluations" >> ${RELE_NOTE} |
| 144 | + echo "\`\`\`json" >> ${RELE_NOTE} |
| 145 | + cat gas_costs.json >> ${RELE_NOTE} |
| 146 | + echo "" >> ${RELE_NOTE} |
| 147 | + echo "\`\`\`" >> ${RELE_NOTE} |
| 148 | + echo "" >> ${RELE_NOTE} |
| 149 | +
|
| 150 | + - name: Echo release note |
| 151 | + run: | |
| 152 | + cat ${{ github.workspace }}/build/release_note.md |
| 153 | +
|
| 154 | + - name: Release for non-tagged commit |
| 155 | + uses: actions/upload-artifact@v3 |
| 156 | + if: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 157 | + with: |
| 158 | + name: non_tagged_release |
| 159 | + path: | |
| 160 | + ${{ github.workspace }}/build/release_note.md |
| 161 | + ${{ github.workspace }}/build/IASRootCertMgr.bin |
| 162 | + ${{ github.workspace }}/build/IASRootCertMgr.abi |
| 163 | + ${{ github.workspace }}/build/IASReportCertMgr.bin |
| 164 | + ${{ github.workspace }}/build/IASReportCertMgr.abi |
| 165 | + ${{ github.workspace }}/build/DecentServerCertMgr.bin |
| 166 | + ${{ github.workspace }}/build/DecentServerCertMgr.abi |
| 167 | + ${{ github.workspace }}/build/HelloWorldApp.bin |
| 168 | + ${{ github.workspace }}/build/HelloWorldApp.abi |
| 169 | + ${{ github.workspace }}/build/gas_costs.json |
| 170 | +
|
| 171 | + - name: Release |
| 172 | + uses: softprops/action-gh-release@v1 |
| 173 | + if: startsWith(github.ref, 'refs/tags/') |
| 174 | + with: |
| 175 | + body_path: ${{ github.workspace }}/build/release_note.md |
| 176 | + files: | |
| 177 | + ${{ github.workspace }}/build/IASRootCertMgr.bin |
| 178 | + ${{ github.workspace }}/build/IASRootCertMgr.abi |
| 179 | + ${{ github.workspace }}/build/IASReportCertMgr.bin |
| 180 | + ${{ github.workspace }}/build/IASReportCertMgr.abi |
| 181 | + ${{ github.workspace }}/build/DecentServerCertMgr.bin |
| 182 | + ${{ github.workspace }}/build/DecentServerCertMgr.abi |
| 183 | + ${{ github.workspace }}/build/HelloWorldApp.bin |
| 184 | + ${{ github.workspace }}/build/HelloWorldApp.abi |
| 185 | + ${{ github.workspace }}/build/gas_costs.json |
0 commit comments