run-network-tests.yml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. name: Integration Tests (Runtime Upgrade)
  73. needs: build_images
  74. runs-on: ubuntu-latest
  75. steps:
  76. - uses: actions/checkout@v1
  77. - uses: actions/setup-node@v1
  78. with:
  79. node-version: '12.x'
  80. - name: Get artifacts
  81. uses: actions/download-artifact@v2
  82. with:
  83. name: ${{ needs.build_images.outputs.use_artifact }}
  84. - name: Install artifacts
  85. run: |
  86. docker load --input joystream-node-docker-image.tar.gz
  87. docker images
  88. - name: Install packages and dependencies
  89. run: yarn install --frozen-lockfile
  90. - name: Ensure tests are runnable
  91. run: yarn workspace network-tests build
  92. - name: Execute network tests
  93. run: RUNTIME=babylon tests/network-tests/run-tests.sh full
  94. basic_runtime:
  95. name: Integration Tests (New Chain)
  96. needs: build_images
  97. runs-on: ubuntu-latest
  98. steps:
  99. - uses: actions/checkout@v1
  100. - uses: actions/setup-node@v1
  101. with:
  102. node-version: '12.x'
  103. - name: Get artifacts
  104. uses: actions/download-artifact@v2
  105. with:
  106. name: ${{ needs.build_images.outputs.use_artifact }}
  107. - name: Install artifacts
  108. run: |
  109. docker load --input joystream-node-docker-image.tar.gz
  110. docker images
  111. - name: Install packages and dependencies
  112. run: yarn install --frozen-lockfile
  113. - name: Ensure tests are runnable
  114. run: yarn workspace network-tests build
  115. - name: Execute network tests
  116. run: tests/network-tests/run-tests.sh full
  117. content_dir_init:
  118. name: Content Directory Initialization
  119. needs: build_images
  120. runs-on: ubuntu-latest
  121. steps:
  122. - uses: actions/checkout@v1
  123. - uses: actions/setup-node@v1
  124. with:
  125. node-version: '12.x'
  126. - name: Get artifacts
  127. uses: actions/download-artifact@v2
  128. with:
  129. name: ${{ needs.build_images.outputs.use_artifact }}
  130. - name: Install artifacts
  131. run: |
  132. docker load --input joystream-node-docker-image.tar.gz
  133. docker images
  134. - name: Install packages and dependencies
  135. run: yarn install --frozen-lockfile
  136. - name: Ensure tests are runnable
  137. run: yarn workspace @joystream/cd-schemas checks --quiet
  138. - name: Start chain
  139. run: docker-compose up -d joystream-node
  140. - name: Initialize the content directory
  141. run: yarn workspace @joystream/cd-schemas initialize:dev
  142. query_node:
  143. name: Query Node Integration Tests
  144. needs: build_images
  145. runs-on: ubuntu-latest
  146. steps:
  147. - uses: actions/checkout@v1
  148. - uses: actions/setup-node@v1
  149. with:
  150. node-version: '12.x'
  151. - name: Get artifacts
  152. uses: actions/download-artifact@v2
  153. with:
  154. name: ${{ needs.build_images.outputs.use_artifact }}
  155. - name: Install artifacts
  156. run: |
  157. docker load --input joystream-node-docker-image.tar.gz
  158. docker images
  159. - name: Install packages and dependencies
  160. run: yarn install --frozen-lockfile
  161. - name: Ensure query-node builds
  162. run: yarn workspace query-node-root build
  163. - name: Ensure tests are runnable
  164. run: yarn workspace network-tests build
  165. # Bring up hydra query-node development instance, then run content directory
  166. # integration tests
  167. - name: Execute Tests
  168. run: query-node/run-tests.sh
  169. storage_node:
  170. name: Storage Node Tests
  171. needs: build_images
  172. runs-on: ubuntu-latest
  173. steps:
  174. - uses: actions/checkout@v1
  175. - uses: actions/setup-node@v1
  176. with:
  177. node-version: '12.x'
  178. - name: Get artifacts
  179. uses: actions/download-artifact@v2
  180. with:
  181. name: ${{ needs.build_images.outputs.use_artifact }}
  182. - name: Install artifacts
  183. run: |
  184. docker load --input joystream-node-docker-image.tar.gz
  185. docker images
  186. - name: Install packages and dependencies
  187. run: yarn install --frozen-lockfile
  188. - name: Build storage node
  189. run: yarn workspace storage-node build
  190. - name: Start Services
  191. run: |
  192. docker-compose up -d ipfs
  193. docker-compose up -d joystream-node
  194. - name: Configure and start development storage node
  195. run: |
  196. DEBUG=* yarn storage-cli dev-init
  197. docker-compose up -d colossus
  198. - name: Test uploading
  199. run: |
  200. WAIT_TIME=90
  201. export DEBUG=joystream:*
  202. for i in {1..4}; do
  203. [ "$i" == "4" ] && exit -1
  204. echo "Waiting for ipfs name registration"
  205. sleep ${WAIT_TIME}
  206. if yarn storage-cli upload ./pioneer/packages/apps/public/images/default-thumbnail.png 1 0; then
  207. break
  208. else
  209. echo "Upload test failed, will retry"
  210. fi
  211. done