run-network-tests-pull-request.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. name: run-network-tests-pull-request
  2. on:
  3. pull_request:
  4. types: [labeled, synchronize]
  5. jobs:
  6. build_images:
  7. name: Prepare joystream/node docker image
  8. if: contains(github.event.pull_request.labels.*.name, 'run-network-tests')
  9. runs-on: ubuntu-latest
  10. outputs:
  11. use_artifact: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  12. steps:
  13. - uses: actions/checkout@v1
  14. - uses: actions/setup-node@v1
  15. with:
  16. node-version: '12.x'
  17. - uses: technote-space/get-diff-action@v3
  18. with:
  19. PREFIX_FILTER: |
  20. node
  21. runtime-modules
  22. utils/chain-spec-builder
  23. SUFFIX_FILTER: |
  24. .rs
  25. FILES: |
  26. Cargo.lock
  27. Cargo.toml
  28. # TODO: Look for change in source code but no corresponding version bump of runtime or binaries
  29. # - name: Check version modified correctly
  30. # if: env.GIT_DIFF
  31. - id: compute_shasum
  32. name: Compute runtime code shasum
  33. run: |
  34. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  35. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  36. - name: Check if we have a pre-built image in Artifacts
  37. continue-on-error: true
  38. uses: actions/download-artifact@v2
  39. with:
  40. name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  41. - name: Check if we have pre-built image on Dockerhub
  42. continue-on-error: true
  43. run: |
  44. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  45. export JOYSTREAM_NODE_TAG=${{ steps.compute_shasum.outputs.shasum }}
  46. docker pull joystream/node:${JOYSTREAM_NODE_TAG}
  47. docker image tag joystream/node:${JOYSTREAM_NODE_TAG} joystream/node:latest
  48. docker save --output joystream-node-docker-image.tar joystream/node:latest
  49. gzip joystream-node-docker-image.tar
  50. echo "::set-env name=UPLOAD_NEW_ARTIFACT::true"
  51. fi
  52. - name: Build new joystream/node image
  53. run: |
  54. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  55. export JOYSTREAM_NODE_TAG=latest
  56. docker-compose build
  57. docker save --output joystream-node-docker-image.tar joystream/node
  58. gzip joystream-node-docker-image.tar
  59. echo "::set-env name=UPLOAD_NEW_ARTIFACT::true"
  60. fi
  61. - name: Save joystream/node image to Artifacts
  62. uses: actions/upload-artifact@v2
  63. with:
  64. name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  65. path: joystream-node-docker-image.tar.gz
  66. if: env.UPLOAD_NEW_ARTIFACT
  67. network_tests_1:
  68. name: Network Integration Runtime Tests
  69. needs: build_images
  70. runs-on: ubuntu-latest
  71. steps:
  72. - uses: actions/checkout@v1
  73. - uses: actions/setup-node@v1
  74. with:
  75. node-version: '12.x'
  76. - name: Get artifacts
  77. uses: actions/download-artifact@v2
  78. with:
  79. name: ${{ needs.build_images.outputs.use_artifact }}
  80. - name: Install artifacts
  81. run: |
  82. docker load --input joystream-node-docker-image.tar.gz
  83. docker images
  84. - name: Install packages and dependencies
  85. run: yarn install --frozen-lockfile
  86. - name: Ensure tests are runnable
  87. run: yarn workspace network-tests build
  88. - name: Start chain
  89. run: docker-compose up -d
  90. - name: Execute network tests
  91. run: yarn workspace network-tests test
  92. network_tests_2:
  93. name: Query Node Tests (Placeholder)
  94. needs: build_images
  95. runs-on: ubuntu-latest
  96. steps:
  97. - uses: actions/checkout@v1
  98. - uses: actions/setup-node@v1
  99. with:
  100. node-version: '12.x'
  101. - name: Get artifacts
  102. uses: actions/download-artifact@v2
  103. with:
  104. name: ${{ needs.build_images.outputs.use_artifact }}
  105. - name: Install artifacts
  106. run: |
  107. docker load --input joystream-node-docker-image.tar.gz
  108. docker images
  109. - name: Install packages and dependencies
  110. run: yarn install --frozen-lockfile
  111. - name: Ensure tests are runnable
  112. run: yarn workspace network-tests build
  113. - name: Start chain
  114. run: docker-compose up -d
  115. # - name: Execute network tests
  116. # run: yarn workspace network-tests test
  117. network_tests_3:
  118. name: Storage Node Tests
  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: |
  136. yarn install --frozen-lockfile
  137. yarn workspace storage-node build
  138. - name: Build storage node
  139. run: yarn workspace storage-node build
  140. - name: Start chain
  141. run: docker-compose up -d
  142. - name: Execute tests
  143. run: DEBUG=* yarn storage-cli dev-init