run-network-tests.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. env:
  30. RUNTIME_PROFILE: "TESTING"
  31. run: |
  32. export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
  33. echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
  34. - name: Setup cache directory
  35. run: mkdir ~/docker-images
  36. - name: Cache docker images
  37. uses: actions/cache@v2
  38. env:
  39. cache-name: joystream-node-docker
  40. with:
  41. path: ~/docker-images
  42. key: ${{ env.cache-name }}-${{ steps.compute_shasum.outputs.shasum }}
  43. - name: Check if we have cached image
  44. continue-on-error: true
  45. run: |
  46. if [ -f ~/docker-images/joystream-node-docker-image.tar.gz ]; then
  47. docker load --input ~/docker-images/joystream-node-docker-image.tar.gz
  48. cp ~/docker-images/joystream-node-docker-image.tar.gz .
  49. fi
  50. - name: Check if we have pre-built image on Dockerhub
  51. continue-on-error: true
  52. run: |
  53. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  54. docker pull joystream/node:${{ steps.compute_shasum.outputs.shasum }}
  55. docker image tag joystream/node:${{ steps.compute_shasum.outputs.shasum }} joystream/node:latest
  56. docker save --output joystream-node-docker-image.tar joystream/node:latest
  57. gzip joystream-node-docker-image.tar
  58. cp joystream-node-docker-image.tar.gz ~/docker-images/
  59. fi
  60. - name: Build new joystream/node image
  61. run: |
  62. if ! [ -f joystream-node-docker-image.tar.gz ]; then
  63. docker build .\
  64. --file joystream-node.Dockerfile\
  65. --tag joystream/node\
  66. --build-arg CARGO_FEATURES="testing_runtime"
  67. docker save --output joystream-node-docker-image.tar joystream/node
  68. gzip joystream-node-docker-image.tar
  69. cp joystream-node-docker-image.tar.gz ~/docker-images/
  70. fi
  71. - name: Save joystream/node image to Artifacts
  72. uses: actions/upload-artifact@v2
  73. with:
  74. name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
  75. path: joystream-node-docker-image.tar.gz
  76. basic_runtime:
  77. name: Integration Tests (New Chain)
  78. needs: build_images
  79. runs-on: ubuntu-latest
  80. steps:
  81. - uses: actions/checkout@v1
  82. - uses: actions/setup-node@v1
  83. with:
  84. node-version: '14.x'
  85. - name: Get artifacts
  86. uses: actions/download-artifact@v2
  87. with:
  88. name: ${{ needs.build_images.outputs.use_artifact }}
  89. - name: Install artifacts
  90. run: |
  91. docker load --input joystream-node-docker-image.tar.gz
  92. docker images
  93. - name: Install packages and dependencies
  94. run: |
  95. yarn install --frozen-lockfile
  96. yarn workspace @joystream/types build
  97. yarn workspace @joystream/metadata-protobuf build
  98. yarn workspace @joystream/cli build
  99. - name: Ensure tests are runnable
  100. run: yarn workspace network-tests build
  101. - name: Execute network tests
  102. run: |
  103. export RUNTIME=latest
  104. tests/network-tests/run-full-tests.sh
  105. new_chain_setup:
  106. name: Initialize new chain
  107. needs: build_images
  108. runs-on: ubuntu-latest
  109. steps:
  110. - uses: actions/checkout@v1
  111. - uses: actions/setup-node@v1
  112. with:
  113. node-version: '14.x'
  114. - name: Get artifacts
  115. uses: actions/download-artifact@v2
  116. with:
  117. name: ${{ needs.build_images.outputs.use_artifact }}
  118. - name: Install artifacts
  119. run: |
  120. docker load --input joystream-node-docker-image.tar.gz
  121. docker images
  122. - name: Install packages and dependencies
  123. run: |
  124. yarn install --frozen-lockfile
  125. yarn workspace @joystream/types build
  126. yarn workspace @joystream/metadata-protobuf build
  127. yarn workspace @joystream/cli build
  128. - name: Ensure query-node builds
  129. run: yarn workspace query-node-root build
  130. - name: Ensure tests are runnable
  131. run: yarn workspace network-tests build
  132. # Bring up hydra query-node development instance, then run content directory
  133. # integration tests
  134. - name: Execute Tests
  135. run: |
  136. export RUNTIME=latest
  137. tests/network-tests/test-setup-new-chain.sh