run-network-tests.yml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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: '14.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 }}
  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: '14.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 workspace @joystream/types build
  93. yarn workspace @joystream/metadata-protobuf build
  94. yarn workspace @joystream/cli build
  95. - name: Ensure tests are runnable
  96. run: yarn workspace network-tests build
  97. - name: Execute network tests
  98. run: RUNTIME=sumer tests/network-tests/run-migration-tests.sh full
  99. basic_runtime:
  100. name: Integration Tests (New Chain)
  101. needs: build_images
  102. runs-on: ubuntu-latest
  103. steps:
  104. - uses: actions/checkout@v1
  105. - uses: actions/setup-node@v1
  106. with:
  107. node-version: '14.x'
  108. - name: Get artifacts
  109. uses: actions/download-artifact@v2
  110. with:
  111. name: ${{ needs.build_images.outputs.use_artifact }}
  112. - name: Install artifacts
  113. run: |
  114. docker load --input joystream-node-docker-image.tar.gz
  115. docker images
  116. - name: Install packages and dependencies
  117. run: |
  118. yarn install --frozen-lockfile
  119. yarn workspace @joystream/types build
  120. yarn workspace @joystream/metadata-protobuf build
  121. - name: Ensure tests are runnable
  122. run: yarn workspace network-tests build
  123. - name: Execute network tests
  124. run: tests/network-tests/run-tests.sh full
  125. query_node:
  126. name: Query Node Integration Tests
  127. needs: build_images
  128. runs-on: ubuntu-latest
  129. steps:
  130. - uses: actions/checkout@v1
  131. - uses: actions/setup-node@v1
  132. with:
  133. node-version: '14.x'
  134. - name: Get artifacts
  135. uses: actions/download-artifact@v2
  136. with:
  137. name: ${{ needs.build_images.outputs.use_artifact }}
  138. - name: Install artifacts
  139. run: |
  140. docker load --input joystream-node-docker-image.tar.gz
  141. docker images
  142. - name: Install packages and dependencies
  143. run: |
  144. yarn install --frozen-lockfile
  145. yarn workspace @joystream/types build
  146. yarn workspace @joystream/metadata-protobuf build
  147. - name: Ensure query-node builds
  148. run: yarn workspace query-node-root build
  149. - name: Ensure tests are runnable
  150. run: yarn workspace network-tests build
  151. # Bring up hydra query-node development instance, then run content directory
  152. # integration tests
  153. - name: Execute Tests
  154. run: |
  155. docker-compose up -d joystream-node
  156. query-node/run-tests.sh
  157. storage_node:
  158. name: Storage Node Tests
  159. needs: build_images
  160. runs-on: ubuntu-latest
  161. steps:
  162. - uses: actions/checkout@v1
  163. - uses: actions/setup-node@v1
  164. with:
  165. node-version: '14.x'
  166. - name: Get artifacts
  167. uses: actions/download-artifact@v2
  168. with:
  169. name: ${{ needs.build_images.outputs.use_artifact }}
  170. - name: Install artifacts
  171. run: |
  172. docker load --input joystream-node-docker-image.tar.gz
  173. docker images
  174. - name: Install packages and dependencies
  175. run: |
  176. yarn install --frozen-lockfile
  177. yarn workspace @joystream/types build
  178. - name: Build storage node
  179. run: yarn workspace storage-node build
  180. - name: Start Services
  181. run: |
  182. docker-compose up -d ipfs
  183. docker-compose up -d joystream-node
  184. - name: Configure and start development storage node
  185. run: |
  186. DEBUG=joystream:* yarn storage-cli dev-init
  187. docker-compose up -d colossus
  188. - name: Test uploading
  189. run: |
  190. sleep 6
  191. export DEBUG=joystream:*
  192. yarn storage-cli upload ./tests/network-tests/assets/joystream.MOV 1 0
  193. # Wait for storage-node to set status Accepted on uploaded content
  194. sleep 6
  195. cd utils/api-scripts/
  196. # Assume only one accepted data object was created
  197. CONTENT_ID=`yarn --silent script get-first-content-id | tail -n2 | head -n1`
  198. yarn storage-cli download ${CONTENT_ID} ./joystream.mov