run-network-tests.yml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. name: run-network-tests
  2. on:
  3. pull_request:
  4. types: [opened, synchronize]
  5. workflow_dispatch:
  6. # TODO: add an input so dispatcher can specify a list of tests to run,
  7. # composed of the job ids separated by `:`
  8. # for eg.
  9. # 'network_tests_1:network_tests_3'
  10. # 'network_tests_2'
  11. # inputs:
  12. # test_to_run:
  13. # description: 'Tests to run'
  14. # required: false
  15. # default: 'all'
  16. jobs:
  17. build_images:
  18. name: Build joystream/node
  19. runs-on: ubuntu-latest
  20. outputs:
  21. use_artifact: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  22. steps:
  23. - uses: actions/checkout@v1
  24. - uses: actions/setup-node@v1
  25. with:
  26. node-version: '12.x'
  27. - id: compute_shasum
  28. name: Compute runtime code shasum
  29. run: |
  30. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  31. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  32. - name: Setup cache directory
  33. run: mkdir ~/docker-images
  34. - name: Cache docker images
  35. uses: actions/cache@v2
  36. env:
  37. cache-name: joystream-node-docker
  38. with:
  39. path: ~/docker-images
  40. key: ${{ env.cache-name }}-${{ steps.compute_shasum.outputs.shasum }}
  41. - name: Check if we have cached image
  42. continue-on-error: true
  43. run: |
  44. if [ -f ~/docker-images/joystream-node-docker-image.tar.gz ]; then
  45. docker load --input ~/docker-images/joystream-node-docker-image.tar.gz
  46. cp ~/docker-images/joystream-node-docker-image.tar.gz .
  47. fi
  48. - name: Check if we have pre-built image on Dockerhub
  49. continue-on-error: true
  50. run: |
  51. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  52. docker pull joystream/node:${{ steps.compute_shasum.outputs.shasum }}
  53. docker image tag joystream/node:${{ steps.compute_shasum.outputs.shasum }} joystream/node:latest
  54. docker save --output joystream-node-docker-image.tar joystream/node:latest
  55. gzip joystream-node-docker-image.tar
  56. cp joystream-node-docker-image.tar.gz ~/docker-images/
  57. fi
  58. - name: Build new joystream/node image
  59. run: |
  60. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  61. docker build . --file joystream-node.Dockerfile --tag joystream/node
  62. docker save --output joystream-node-docker-image.tar joystream/node
  63. gzip joystream-node-docker-image.tar
  64. cp joystream-node-docker-image.tar.gz ~/docker-images/
  65. fi
  66. - name: Save joystream/node image to Artifacts
  67. uses: actions/upload-artifact@v2
  68. with:
  69. name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  70. path: joystream-node-docker-image.tar.gz
  71. basic_runtime_with_upgrade:
  72. if: ${{ false }} # Antioch will be a new chain
  73. name: Integration Tests (Runtime Upgrade)
  74. needs: build_images
  75. runs-on: ubuntu-latest
  76. steps:
  77. - uses: actions/checkout@v1
  78. - uses: actions/setup-node@v1
  79. with:
  80. node-version: '12.x'
  81. - name: Get artifacts
  82. uses: actions/download-artifact@v2
  83. with:
  84. name: ${{ needs.build_images.outputs.use_artifact }}
  85. - name: Install artifacts
  86. run: |
  87. docker load --input joystream-node-docker-image.tar.gz
  88. docker images
  89. - name: Install packages and dependencies
  90. run: |
  91. yarn install --frozen-lockfile
  92. yarn build:packages
  93. - name: Ensure tests are runnable
  94. run: yarn workspace network-tests build
  95. - name: Execute network tests
  96. run: RUNTIME=babylon tests/network-tests/run-tests.sh full
  97. basic_runtime:
  98. name: Integration Tests (New Chain)
  99. needs: build_images
  100. runs-on: ubuntu-latest
  101. steps:
  102. - uses: actions/checkout@v1
  103. - uses: actions/setup-node@v1
  104. with:
  105. node-version: '12.x'
  106. - name: Get artifacts
  107. uses: actions/download-artifact@v2
  108. with:
  109. name: ${{ needs.build_images.outputs.use_artifact }}
  110. - name: Install artifacts
  111. run: |
  112. docker load --input joystream-node-docker-image.tar.gz
  113. docker images
  114. - name: Install packages and dependencies
  115. run: |
  116. yarn install --frozen-lockfile
  117. yarn build:packages
  118. - name: Ensure tests are runnable
  119. run: yarn workspace network-tests build
  120. - name: Execute network tests
  121. run: tests/network-tests/run-tests.sh full
  122. content_dir_init:
  123. name: Content Directory Initialization
  124. needs: build_images
  125. runs-on: ubuntu-latest
  126. steps:
  127. - uses: actions/checkout@v1
  128. - uses: actions/setup-node@v1
  129. with:
  130. node-version: '12.x'
  131. - name: Get artifacts
  132. uses: actions/download-artifact@v2
  133. with:
  134. name: ${{ needs.build_images.outputs.use_artifact }}
  135. - name: Install artifacts
  136. run: |
  137. docker load --input joystream-node-docker-image.tar.gz
  138. docker images
  139. - name: Install packages and dependencies
  140. run: |
  141. yarn install --frozen-lockfile
  142. yarn workspace @joystream/types build
  143. yarn workspace @joystream/cd-schemas generate:all
  144. yarn workspace @joystream/cd-schemas build
  145. - name: Ensure tests are runnable
  146. run: yarn workspace @joystream/cd-schemas checks --quiet
  147. - name: Start chain
  148. run: docker-compose up -d joystream-node
  149. - name: Initialize the content directory
  150. run: yarn workspace @joystream/cd-schemas initialize:dev
  151. query_node:
  152. name: Query Node Integration Tests
  153. needs: build_images
  154. runs-on: ubuntu-latest
  155. steps:
  156. - uses: actions/checkout@v1
  157. - uses: actions/setup-node@v1
  158. with:
  159. node-version: '12.x'
  160. - name: Get artifacts
  161. uses: actions/download-artifact@v2
  162. with:
  163. name: ${{ needs.build_images.outputs.use_artifact }}
  164. - name: Install artifacts
  165. run: |
  166. docker load --input joystream-node-docker-image.tar.gz
  167. docker images
  168. - name: Install packages and dependencies
  169. run: |
  170. yarn install --frozen-lockfile
  171. yarn workspace @joystream/types build
  172. yarn workspace @joystream/cd-schemas generate:all
  173. yarn workspace @joystream/cd-schemas build
  174. yarn workspace query-node-root build
  175. - name: Ensure tests are runnable
  176. run: yarn workspace network-tests build
  177. # Bring up hydra query-node development instance, then run content directory
  178. # integration tests
  179. - name: Execute Tests
  180. run: query-node/run-tests.sh
  181. storage_node:
  182. name: Storage Node Tests
  183. needs: build_images
  184. runs-on: ubuntu-latest
  185. steps:
  186. - uses: actions/checkout@v1
  187. - uses: actions/setup-node@v1
  188. with:
  189. node-version: '12.x'
  190. - name: Get artifacts
  191. uses: actions/download-artifact@v2
  192. with:
  193. name: ${{ needs.build_images.outputs.use_artifact }}
  194. - name: Install artifacts
  195. run: |
  196. docker load --input joystream-node-docker-image.tar.gz
  197. docker images
  198. - name: Install packages and dependencies
  199. run: |
  200. yarn install --frozen-lockfile
  201. yarn workspace @joystream/types build
  202. - name: Build storage node
  203. run: yarn workspace storage-node build
  204. - name: Start Services
  205. run: |
  206. docker-compose up -d ipfs
  207. docker-compose up -d joystream-node
  208. - name: Configure and start development storage node
  209. run: |
  210. DEBUG=* yarn storage-cli dev-init
  211. docker-compose up -d colossus
  212. - name: Test uploading
  213. run: |
  214. WAIT_TIME=90
  215. export DEBUG=joystream:*
  216. for i in {1..4}; do
  217. [ "$i" == "4" ] && exit -1
  218. echo "Waiting for ipfs name registration"
  219. sleep ${WAIT_TIME}
  220. if yarn storage-cli upload ./pioneer/packages/apps/public/images/default-thumbnail.png 1 0; then
  221. break
  222. else
  223. echo "Upload test failed, will retry"
  224. fi
  225. done