run-integration-tests.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. name: run-integration-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. TEST_NODE: true
  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 TEST_NODE=true
  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. query_node:
  77. name: Query Node Integration Tests
  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. - name: Ensure tests are runnable
  99. run: yarn workspace integration-tests build
  100. # Bring up hydra query-node development instance, then run integration tests
  101. - name: Execute Tests
  102. run: query-node/run-tests.sh