release.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. on:
  2. push:
  3. tags:
  4. - 'v*'
  5. name: Build Release Binaries
  6. jobs:
  7. linux-x86-64:
  8. name: Linux x86-64
  9. runs-on: ubuntu-latest
  10. container: ghcr.io/hyperledger/solang-llvm:ci
  11. steps:
  12. - name: Checkout sources
  13. uses: actions/checkout@v3.1.0
  14. with:
  15. submodules: recursive
  16. - name: Rust stable
  17. run: rustup default 1.65.0
  18. - name: Build
  19. run: cargo build --verbose --release
  20. - name: Run tests
  21. run: cargo test --workspace --verbose --release
  22. - name: Upload binary
  23. uses: svenstaro/upload-release-action@v2
  24. with:
  25. repo_token: ${{ secrets.GITHUB_TOKEN }}
  26. file: target/release/solang
  27. asset_name: solang-linux-x86-64
  28. tag: ${{ github.ref }}
  29. linux-arm64:
  30. name: Linux arm64
  31. runs-on: linux-arm64
  32. if: ${{ github.repository_owner == 'hyperledger' }}
  33. container: ghcr.io/hyperledger/solang-llvm:ci
  34. steps:
  35. - name: Checkout sources
  36. uses: actions/checkout@v3.1.0
  37. with:
  38. submodules: recursive
  39. - name: Rust stable
  40. run: rustup default 1.65.0
  41. - name: Build
  42. run: cargo build --verbose --release
  43. - name: Run tests
  44. run: cargo test --workspace --verbose --release
  45. - name: Upload binary
  46. uses: svenstaro/upload-release-action@v2
  47. with:
  48. repo_token: ${{ secrets.GITHUB_TOKEN }}
  49. file: target/release/solang
  50. asset_name: solang-linux-arm64
  51. tag: ${{ github.ref }}
  52. windows:
  53. name: Windows
  54. runs-on: windows-latest
  55. steps:
  56. - name: Checkout sources
  57. uses: actions/checkout@v3
  58. with:
  59. submodules: recursive
  60. - name: Download LLVM
  61. run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger/solang-llvm/releases/download/llvm15-0/llvm15.0-win.zip
  62. - name: Extract LLVM
  63. run: unzip c:\llvm.zip -d c:/
  64. - name: Add LLVM to Path
  65. run: echo "c:\llvm15.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
  66. - uses: dtolnay/rust-toolchain@1.65.0
  67. with:
  68. components: clippy
  69. - name: Build
  70. run: cargo build --release --verbose
  71. - name: Run tests
  72. run: cargo test --workspace --release --verbose
  73. - name: Upload binary
  74. uses: svenstaro/upload-release-action@v2
  75. with:
  76. repo_token: ${{ secrets.GITHUB_TOKEN }}
  77. file: target/release/solang.exe
  78. asset_name: solang.exe
  79. tag: ${{ github.ref }}
  80. mac-arm:
  81. name: Mac Arm
  82. runs-on: [self-hosted, macOS, ARM64, MacStadium]
  83. if: ${{ github.repository_owner == 'hyperledger' }}
  84. steps:
  85. - name: Checkout sources
  86. uses: actions/checkout@v3
  87. with:
  88. submodules: recursive
  89. - uses: dtolnay/rust-toolchain@1.65.0
  90. - name: Get LLVM
  91. run: curl -L --output llvm15.0-mac-arm.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-0/llvm15.0-mac-arm.tar.xz
  92. - name: Extract LLVM
  93. run: tar Jxf llvm15.0-mac-arm.tar.xz
  94. - name: Add LLVM to Path
  95. run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
  96. - name: Build
  97. run: cargo build --release --verbose
  98. - name: Run tests
  99. run: cargo test --workspace --release --verbose
  100. - name: Upload binary
  101. uses: svenstaro/upload-release-action@v2
  102. with:
  103. repo_token: ${{ secrets.GITHUB_TOKEN }}
  104. file: target/release/solang
  105. asset_name: solang-mac-arm
  106. tag: ${{ github.ref }}
  107. mac-intel:
  108. name: Mac Intel
  109. # The Hyperledger self-hosted intel macs have the label macos-latest
  110. # and run macos 12. We don't want to build llvm on macos 12, because
  111. # then it can't be used on macos 11.
  112. runs-on: macos-11
  113. steps:
  114. - name: Checkout sources
  115. uses: actions/checkout@v3
  116. with:
  117. submodules: recursive
  118. - uses: dtolnay/rust-toolchain@1.65.0
  119. - name: Get LLVM
  120. run: wget -q -O llvm15.0-mac-intel.tar.xz https://github.com/hyperledger/solang-llvm/releases/download/llvm15-0/llvm15.0-mac-intel.tar.xz
  121. - name: Extract LLVM
  122. run: tar Jxf llvm15.0-mac-intel.tar.xz
  123. - name: Add LLVM to Path
  124. run: echo "$(pwd)/llvm15.0/bin" >> $GITHUB_PATH
  125. - name: Build
  126. run: cargo build --release --verbose
  127. - name: Run tests
  128. run: cargo test --workspace --release --verbose
  129. - name: Upload binary
  130. uses: svenstaro/upload-release-action@v2
  131. with:
  132. repo_token: ${{ secrets.GITHUB_TOKEN }}
  133. file: target/release/solang
  134. asset_name: solang-mac-intel
  135. tag: ${{ github.ref }}
  136. mac-universal:
  137. name: Mac Universal Binary
  138. runs-on: macos-latest
  139. needs: [mac-arm, mac-intel]
  140. steps:
  141. - run: |
  142. curl -L --output solang-mac-intel https://github.com/hyperledger/solang/releases/download/${GITHUB_REF/refs\/tags\//}/solang-mac-intel
  143. curl -L --output solang-mac-arm https://github.com/hyperledger/solang/releases/download/${GITHUB_REF/refs\/tags\//}/solang-mac-arm
  144. lipo -create -output solang-mac solang-mac-intel solang-mac-arm
  145. - name: Upload binary
  146. uses: svenstaro/upload-release-action@v2
  147. with:
  148. repo_token: ${{ secrets.GITHUB_TOKEN }}
  149. file: solang-mac
  150. asset_name: solang-mac
  151. tag: ${{ github.ref }}
  152. container-multiarch:
  153. name: Multiarch Container Image
  154. runs-on: linux-arm64
  155. if: ${{ github.repository_owner == 'hyperledger' }}
  156. steps:
  157. - name: Checkout sources
  158. uses: actions/checkout@v3
  159. - run: |
  160. echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
  161. docker buildx build . \
  162. --push \
  163. --provenance=false \
  164. --tag ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_REF/refs\/tags\//} \
  165. --platform linux/arm64,linux/amd64 \
  166. --label org.opencontainers.image.description="Solidity Compiler for Solana and Substrate version $(git describe --tags)"