test.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. name: Build tests
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. repolinter:
  10. name: Repolinter
  11. runs-on: ubuntu-20.04
  12. steps:
  13. - name: Checkout sources
  14. uses: actions/checkout@v2
  15. - name: Run repolinter
  16. run: npx repolinter --rulesetUrl https://raw.githubusercontent.com/hyperledger-labs/hyperledger-community-management-tools/master/repo_structure/repolint.json
  17. lints:
  18. name: Lints
  19. runs-on: ubuntu-20.04
  20. container: ghcr.io/hyperledger-labs/solang:ci
  21. steps:
  22. - name: Checkout sources
  23. uses: actions/checkout@v2
  24. - name: Rust stable
  25. run: rustup default stable
  26. - name: Run cargo fmt
  27. run: cargo fmt --all -- --check
  28. - name: Run cargo clippy
  29. run: cargo clippy --workspace --tests --bins -- -D warnings -D clippy::inconsistent-struct-constructor
  30. docs:
  31. name: Docs
  32. runs-on: ubuntu-latest
  33. container: ubuntu:22.04
  34. steps:
  35. - name: Checkout sources
  36. uses: actions/checkout@v2
  37. - name: Install sphinx
  38. run: |
  39. export DEBIAN_FRONTEND=noninteractive
  40. apt-get update
  41. apt-get install -y python3-sphinx python3-sphinx-rtd-theme
  42. - name: Build docs
  43. run: make html
  44. working-directory: docs
  45. linux-x86-64:
  46. name: Linux x86-64
  47. runs-on: ubuntu-20.04
  48. container: ghcr.io/hyperledger-labs/solang:ci
  49. steps:
  50. - name: Checkout sources
  51. # Make sure "git describe --tags" works for solang --version
  52. # checkout@v2 requires git 2.18 or higher, which is not in our image
  53. uses: actions/checkout@v1
  54. with:
  55. submodules: recursive
  56. - name: Rust stable
  57. run: rustup default 1.59.0
  58. - name: Build
  59. run: cargo build --verbose
  60. - name: Run tests
  61. run: cargo test --verbose --workspace
  62. - uses: actions/upload-artifact@master
  63. with:
  64. name: solang-linux-x86-64
  65. path: ./target/debug/solang
  66. linux-arm:
  67. name: Linux Arm
  68. runs-on: linux-arm64
  69. # Don't run linux-arm64 on pull requests, it takes 38 minutes and only has one runner
  70. if: ${{ github.repository_owner == 'hyperledger-labs' && github.ref == 'refs/heads/main' }}
  71. container: ghcr.io/hyperledger-labs/solang:ci
  72. steps:
  73. - name: Checkout sources
  74. # Make sure "git describe --tags" works for solang --version
  75. # checkout@v2 requires git 2.18 or higher, which is not in our image
  76. uses: actions/checkout@v1
  77. with:
  78. submodules: recursive
  79. - name: Rust stable
  80. run: rustup default 1.59.0
  81. - name: Build
  82. run: cargo build --verbose
  83. - name: Run tests
  84. run: cargo test --verbose --workspace
  85. - uses: actions/upload-artifact@master
  86. with:
  87. name: solang-linux-arm64
  88. path: ./target/debug/solang
  89. windows:
  90. name: Windows
  91. runs-on: windows-latest
  92. steps:
  93. - name: Checkout sources
  94. uses: actions/checkout@v2
  95. with:
  96. # Make sure "git describe --tags" works for solang --version
  97. fetch-depth: 0
  98. submodules: recursive
  99. - name: Download LLVM
  100. run: curl -sSL -o c:\llvm.zip https://github.com/hyperledger-labs/solang/releases/download/v0.1.11/llvm13.0-win.zip
  101. - name: Extract LLVM
  102. run: unzip c:\llvm.zip -d c:/
  103. - name: Add LLVM to Path
  104. run: echo "c:\llvm13.0\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
  105. - name: Stable with rustfmt and clippy
  106. uses: actions-rs/toolchain@v1
  107. with:
  108. profile: minimal
  109. toolchain: stable
  110. components: clippy
  111. # We run clippy on Linux in the lint job above, but this does not check #[cfg(windows)] items
  112. - name: Run cargo clippy
  113. run: cargo clippy --workspace --tests --bins -- -D warnings -D clippy::inconsistent-struct-constructor
  114. - name: Build
  115. run: cargo build --verbose
  116. - name: Run tests
  117. run: cargo test --verbose --workspace
  118. - uses: actions/upload-artifact@master
  119. with:
  120. name: solang.exe
  121. path: ./target/debug/solang.exe
  122. mac-arm:
  123. name: Mac Arm
  124. runs-on: macos-arm
  125. if: ${{ github.repository_owner == 'hyperledger-labs' }}
  126. steps:
  127. - name: Checkout sources
  128. uses: actions/checkout@v2
  129. with:
  130. # Make sure "git describe --tags" works for solang --version
  131. fetch-depth: 0
  132. submodules: recursive
  133. - name: Download LLVM
  134. run: curl -L --output llvm13.0-mac-arm.tar.xz https://github.com/hyperledger-labs/solang/releases/download/v0.1.11/llvm13.0-mac-arm.tar.xz
  135. - name: Extract LLVM
  136. run: tar Jxf llvm13.0-mac-arm.tar.xz
  137. - name: Add LLVM to Path
  138. run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
  139. - name: Build
  140. run: cargo build --verbose
  141. - name: Run tests
  142. run: cargo test --verbose --workspace
  143. - uses: actions/upload-artifact@master
  144. with:
  145. name: solang-mac-arm
  146. path: ./target/debug/solang
  147. mac-intel:
  148. name: Mac Intel
  149. runs-on: macos-latest
  150. steps:
  151. - name: Checkout sources
  152. uses: actions/checkout@v2
  153. with:
  154. # Make sure "git describe --tags" works for solang --version
  155. fetch-depth: 0
  156. submodules: recursive
  157. - name: Download LLVM
  158. run: wget -q -O llvm13.0-mac-intel.tar.xz https://github.com/hyperledger-labs/solang/releases/download/v0.1.11/llvm13.0-mac-intel.tar.xz
  159. - name: Extract LLVM
  160. run: tar Jxf llvm13.0-mac-intel.tar.xz
  161. - name: Add LLVM to Path
  162. run: echo "$(pwd)/llvm13.0/bin" >> $GITHUB_PATH
  163. - name: Build
  164. run: cargo build --verbose
  165. - name: Run tests
  166. run: cargo test --verbose --workspace
  167. - uses: actions/upload-artifact@master
  168. with:
  169. name: solang-mac-intel
  170. path: ./target/debug/solang
  171. image-multiarch:
  172. name: Multiarch Container Image
  173. runs-on: macos-arm
  174. if: ${{ github.repository_owner == 'hyperledger-labs' }}
  175. steps:
  176. - name: Checkout sources
  177. uses: actions/checkout@v2
  178. with:
  179. # Make sure "git describe --tags" works for solang --version
  180. fetch-depth: 0
  181. - run: echo "::set-output name=push::--push"
  182. id: push
  183. if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
  184. - run: |
  185. echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
  186. docker buildx build . \
  187. ${{steps.push.outputs.push}} \
  188. -t ghcr.io/${GITHUB_REPOSITORY}:latest \
  189. --platform linux/arm64,linux/amd64 \
  190. --label org.opencontainers.image.description="Solidity Compiler for Solana, Substrate, and ewasm version $(git describe --tags)"
  191. image:
  192. name: Container Image
  193. runs-on: ubuntu-20.04
  194. if: ${{ github.repository_owner != 'hyperledger-labs' }}
  195. steps:
  196. - name: Checkout sources
  197. uses: actions/checkout@v2
  198. with:
  199. # Make sure "git describe --tags" works for solang --version
  200. fetch-depth: 0
  201. - run:
  202. docker build .
  203. -t ghcr.io/${GITHUB_REPOSITORY}:latest
  204. --label org.opencontainers.image.description="Solidity Compiler for Solana, Substrate, and ewasm version $(git describe --tags)"
  205. solana:
  206. name: Solana Integration test
  207. runs-on: ubuntu-20.04
  208. container: ubuntu:20.04
  209. needs: linux-x86-64
  210. services:
  211. solana:
  212. image: solanalabs/solana:v1.9.15
  213. ports:
  214. - 8899
  215. - 8900
  216. steps:
  217. - name: Checkout sources
  218. uses: actions/checkout@v2
  219. - uses: actions/setup-node@v1
  220. with:
  221. node-version: '14'
  222. - uses: actions/download-artifact@master
  223. with:
  224. name: solang-linux-x86-64
  225. path: bin
  226. - run: |
  227. chmod 755 ./bin/solang
  228. echo "$(pwd)/bin" >> $GITHUB_PATH
  229. - run: npm install
  230. working-directory: ./integration/solana
  231. - name: Build Solang contracts
  232. run: npm run build
  233. working-directory: ./integration/solana
  234. - name: Set github env
  235. run: echo "RPC_URL=http://solana:8899/" >> $GITHUB_ENV
  236. - name: Deploy and test contracts
  237. run: npm run test
  238. working-directory: ./integration/solana
  239. substrate:
  240. name: Substrate Integration test
  241. runs-on: ubuntu-20.04
  242. needs: linux-x86-64
  243. steps:
  244. - name: Checkout sources
  245. uses: actions/checkout@v2
  246. # We can't run substrate as a github actions service, since it requires
  247. # command line arguments. See https://github.com/actions/runner/pull/1152
  248. - name: Start substrate
  249. run: docker run -d -p 9944:9944 parity/substrate:v3.0.0 --dev --ws-external
  250. - uses: actions/setup-node@v1
  251. with:
  252. node-version: '14'
  253. - uses: actions/download-artifact@master
  254. with:
  255. name: solang-linux-x86-64
  256. path: bin
  257. - run: |
  258. chmod 755 ./bin/solang
  259. echo "$(pwd)/bin" >> $GITHUB_PATH
  260. - run: npm install
  261. working-directory: ./integration/substrate
  262. - name: Build Solang contracts
  263. run: npm run build
  264. working-directory: ./integration/substrate
  265. - name: Deploy and test contracts
  266. run: npm run test
  267. working-directory: ./integration/substrate
  268. burrow:
  269. name: Burrow Integration test
  270. runs-on: ubuntu-20.04
  271. container: ubuntu:20.04
  272. needs: linux-x86-64
  273. services:
  274. burrow:
  275. image: hyperledger/burrow:0.34.4
  276. ports:
  277. - 10997
  278. steps:
  279. - name: Checkout sources
  280. uses: actions/checkout@v2
  281. - uses: actions/setup-node@v1
  282. with:
  283. node-version: '14'
  284. - uses: actions/download-artifact@master
  285. with:
  286. name: solang-linux-x86-64
  287. path: bin
  288. - run: |
  289. chmod 755 ./bin/solang
  290. echo "$(pwd)/bin" >> $GITHUB_PATH
  291. - run: npm install
  292. working-directory: ./integration/burrow
  293. - name: Build Solang contract
  294. run: npm run build
  295. working-directory: ./integration/burrow
  296. - name: Set github env
  297. run: echo "RPC_URL=burrow:10997" >> $GITHUB_ENV
  298. - name: Deploy and test contract
  299. run: npm run test
  300. working-directory: ./integration/burrow
  301. vscode:
  302. name: Visual Code Extension
  303. runs-on: ubuntu-20.04
  304. needs: linux-x86-64
  305. steps:
  306. - name: Checkout
  307. uses: actions/checkout@v2
  308. - uses: actions/download-artifact@master
  309. with:
  310. name: solang-linux-x86-64
  311. path: bin
  312. - run: |
  313. chmod 755 ./bin/solang
  314. echo "$(pwd)/bin" >> $GITHUB_PATH
  315. - name: Install Node.js
  316. uses: actions/setup-node@v1
  317. with:
  318. node-version: '14'
  319. - run: npm install
  320. working-directory: ./vscode
  321. - run: npm run compile
  322. working-directory: ./vscode
  323. - name: Run headless test
  324. uses: GabrielBB/xvfb-action@v1
  325. with:
  326. working-directory: ./vscode
  327. run: npm test
  328. - run: npm install -g vsce
  329. working-directory: ./vscode
  330. - run: vsce package
  331. working-directory: ./vscode