run-network-tests.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. name: run-network-tests
  2. on:
  3. pull_request:
  4. types: [labeled, synchronize]
  5. workflow_dispatch:
  6. jobs:
  7. build_images:
  8. name: Prepare joystream/node docker image
  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. - id: compute_shasum
  18. name: Compute runtime code shasum
  19. run: |
  20. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  21. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  22. - name: Setup cache directory
  23. run: mkdir ~/docker-images
  24. - name: Cache docker images
  25. uses: actions/cache@v2
  26. env:
  27. cache-name: joystream-node-docker
  28. with:
  29. path: ~/docker-images
  30. key: ${{ env.cache-name }}-${{ steps.compute_shasum.outputs.shasum }}
  31. - name: Check if we have cached image
  32. continue-on-error: true
  33. run: |
  34. if [ -f ~/docker-images/joystream-node-docker-image.tar.gz ]; then
  35. docker load --input ~/docker-images/joystream-node-docker-image.tar.gz
  36. cp ~/docker-images/joystream-node-docker-image.tar.gz .
  37. fi
  38. - name: Check if we have pre-built image on Dockerhub
  39. continue-on-error: true
  40. run: |
  41. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  42. export JOYSTREAM_NODE_TAG=${{ steps.compute_shasum.outputs.shasum }}
  43. docker pull joystream/node:${JOYSTREAM_NODE_TAG}
  44. docker image tag joystream/node:${JOYSTREAM_NODE_TAG} joystream/node:latest
  45. docker save --output joystream-node-docker-image.tar joystream/node:latest
  46. gzip joystream-node-docker-image.tar
  47. cp joystream-node-docker-image.tar.gz ~/docker-images/
  48. fi
  49. - name: Build new joystream/node image
  50. run: |
  51. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  52. docker build . --file joystream-node.Dockerfile --tag joystream/node
  53. docker save --output joystream-node-docker-image.tar joystream/node
  54. gzip joystream-node-docker-image.tar
  55. cp joystream-node-docker-image.tar.gz ~/docker-images/
  56. fi
  57. - name: Save joystream/node image to Artifacts
  58. uses: actions/upload-artifact@v2
  59. with:
  60. name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  61. path: joystream-node-docker-image.tar.gz
  62. network_tests_1:
  63. name: Network Integration Runtime Tests
  64. if: contains(github.event.pull_request.labels.*.name, 'run-network-tests') || github.event.push != null
  65. needs: build_images
  66. runs-on: ubuntu-latest
  67. steps:
  68. - uses: actions/checkout@v1
  69. - uses: actions/setup-node@v1
  70. with:
  71. node-version: '12.x'
  72. - name: Get artifacts
  73. uses: actions/download-artifact@v2
  74. with:
  75. name: ${{ needs.build_images.outputs.use_artifact }}
  76. - name: Install artifacts
  77. run: |
  78. docker load --input joystream-node-docker-image.tar.gz
  79. docker images
  80. - name: Install packages and dependencies
  81. run: yarn install --frozen-lockfile
  82. - name: Ensure tests are runnable
  83. run: yarn workspace network-tests build
  84. - name: Execute network tests
  85. run: tests/network-tests/run-tests.sh
  86. network_tests_2:
  87. name: Query Node Tests (Placeholder)
  88. if: contains(github.event.pull_request.labels.*.name, 'run-network-tests') || github.event.push != null
  89. needs: build_images
  90. runs-on: ubuntu-latest
  91. steps:
  92. - uses: actions/checkout@v1
  93. - uses: actions/setup-node@v1
  94. with:
  95. node-version: '12.x'
  96. - name: Get artifacts
  97. uses: actions/download-artifact@v2
  98. with:
  99. name: ${{ needs.build_images.outputs.use_artifact }}
  100. - name: Install artifacts
  101. run: |
  102. docker load --input joystream-node-docker-image.tar.gz
  103. docker images
  104. - name: Install packages and dependencies
  105. run: yarn install --frozen-lockfile
  106. - name: Ensure tests are runnable
  107. run: yarn workspace network-tests build
  108. - name: Start chain
  109. run: docker-compose up -d
  110. # - name: Execute network tests
  111. # run: yarn workspace network-tests test
  112. network_tests_3:
  113. name: Storage Node Tests
  114. if: contains(github.event.pull_request.labels.*.name, 'run-network-tests') || github.event.push != null
  115. needs: build_images
  116. runs-on: ubuntu-latest
  117. steps:
  118. - uses: actions/checkout@v1
  119. - uses: actions/setup-node@v1
  120. with:
  121. node-version: '12.x'
  122. - name: Get artifacts
  123. uses: actions/download-artifact@v2
  124. with:
  125. name: ${{ needs.build_images.outputs.use_artifact }}
  126. - name: Install artifacts
  127. run: |
  128. docker load --input joystream-node-docker-image.tar.gz
  129. docker images
  130. - name: Install packages and dependencies
  131. run: |
  132. yarn install --frozen-lockfile
  133. yarn workspace storage-node build
  134. - name: Build storage node
  135. run: yarn workspace storage-node build
  136. - name: Start chain
  137. run: docker-compose up -d
  138. - name: Execute tests
  139. run: DEBUG=* yarn storage-cli dev-init