pr.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. name: Pull Request Check
  2. on:
  3. pull_request:
  4. paths-ignore:
  5. - 'docs/**'
  6. - '**.md'
  7. - .gitignore
  8. env:
  9. GO_VERSION: 1.16
  10. jobs:
  11. lint:
  12. name: 'Code linters'
  13. runs-on: ubuntu-20.04
  14. steps:
  15. - name: 'Setup Go ${{ env.GO_VERSION }}'
  16. uses: actions/setup-go@v1
  17. with:
  18. go-version: ${{ env.GO_VERSION }}
  19. - name: 'Check out project files'
  20. uses: actions/checkout@v2
  21. with:
  22. submodules: false
  23. - name: 'Prepare environment'
  24. run: |
  25. echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
  26. - name: 'Run code linters'
  27. run: |
  28. GO111MODULE=on make lint
  29. unit-tests:
  30. name: 'Unit tests in ${{ matrix.os }}'
  31. strategy:
  32. fail-fast: false
  33. matrix:
  34. os: ["ubuntu-20.04"]
  35. env:
  36. QUORUM_IGNORE_TEST_PACKAGES: github.com/ethereum/go-ethereum/les,github.com/ethereum/go-ethereum/les/flowcontrol,github.com/ethereum/go-ethereum/mobile
  37. runs-on: ${{ matrix.os }}
  38. steps:
  39. - name: 'Setup Go ${{ env.GO_VERSION }}'
  40. uses: actions/setup-go@v1
  41. with:
  42. go-version: ${{ env.GO_VERSION }}
  43. - name: 'Check out project files'
  44. uses: actions/checkout@v2
  45. with:
  46. submodules: recursive
  47. - name: 'Prepare environment'
  48. run: |
  49. # https://github.com/actions/virtual-environments/issues/798
  50. sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  51. echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
  52. - name: 'Run unit tests'
  53. run: |
  54. make test
  55. docker-build:
  56. name: 'Build Docker image'
  57. runs-on: ubuntu-20.04
  58. steps:
  59. - name: 'Check out project files'
  60. uses: actions/checkout@v2
  61. - name: 'Build docker image'
  62. id: build
  63. run: |
  64. output_dir=${{ runner.temp }}/docker
  65. mkdir -p $output_dir
  66. docker build -t quorumengineering/quorum:pr .
  67. docker save quorumengineering/quorum:pr > quorum-pr.tar
  68. tar cfvz $output_dir/quorum-pr.tar.gz quorum-pr.tar
  69. echo "::set-output name=output_dir::$output_dir"
  70. - name: 'Upload workflow artifact - Docker image'
  71. uses: actions/upload-artifact@v2
  72. with:
  73. name: docker-image
  74. path: ${{ steps.build.outputs.output_dir }}
  75. peeps-tests:
  76. name: Run PEEPS tests
  77. needs:
  78. - docker-build
  79. runs-on: ubuntu-20.04
  80. steps:
  81. - name: 'Checkout'
  82. uses: actions/checkout@v2
  83. - name: 'Download workflow artifact - Docker image'
  84. uses: actions/download-artifact@v1
  85. with:
  86. name: docker-image
  87. - name: 'Load Docker image'
  88. id: setup
  89. run: |
  90. tar xfvz docker-image/quorum-pr.tar.gz
  91. docker load --input quorum-pr.tar
  92. docker image tag quorumengineering/quorum:pr quorumengineering/quorum:develop
  93. docker image ls
  94. - name: Set up Java
  95. uses: actions/setup-java@v2
  96. with:
  97. distribution: 'adopt'
  98. java-version: 11
  99. check-latest: true
  100. - name: PEEPS
  101. run: |
  102. cd build
  103. ./run-peeps.sh
  104. - name: PEEPS Test Report
  105. uses: mikepenz/action-junit-report@v2
  106. if: always()
  107. with:
  108. report_paths: '**/build/test-results/*/TEST-*.xml'
  109. check_name: PEEPS test report
  110. acceptance-tests:
  111. name: Acceptance tests (${{ matrix.tag }})
  112. needs:
  113. - docker-build
  114. if: success()
  115. strategy:
  116. fail-fast: false
  117. matrix:
  118. # list of tag expression being executed in parallel
  119. # for PR, only selective tests are run.
  120. # More comprehensive suites are scheduled to run in master
  121. tag:
  122. - 'basic || basic-raft || (advanced && raft) || networks/typical::raft'
  123. - 'basic || basic-istanbul || (advanced && istanbul && !block-heights) || networks/typical::istanbul'
  124. - 'basic || basic-istanbul || (advanced && istanbul && !block-heights) || empty-block-period || block-reward || networks/typical::qbft'
  125. - 'validator-management && networks/template::istanbul-3plus1'
  126. - 'validator-management && networks/template::qbft-3plus1'
  127. - 'multitenancy && networks/plugins::raft-multitenancy'
  128. - 'migration && networks/template::istanbul-4nodes'
  129. - 'migration && networks/template::raft-4nodes'
  130. - 'basic || networks/typical::raftmps'
  131. - 'basic || networks/typical::istanbulmps'
  132. - 'basic || networks/typical::qbftmps'
  133. runs-on: ubuntu-20.04
  134. steps:
  135. - name: 'Download workflow artifact - Docker image'
  136. uses: actions/download-artifact@v1
  137. with:
  138. name: docker-image
  139. - name: 'Load Docker image'
  140. id: setup
  141. run: |
  142. tar xfvz docker-image/quorum-pr.tar.gz
  143. docker load --input quorum-pr.tar
  144. docker_env_file="${{ runner.temp }}/env.list"
  145. echo "TF_VAR_quorum_docker_image={ name = \"quorumengineering/quorum:pr\", local = true }" >> $docker_env_file
  146. echo "::set-output name=outputDir::${{ runner.temp }}"
  147. echo "::set-output name=dockerEnvFile::$docker_env_file"
  148. - name: 'Run acceptance tests'
  149. run: |
  150. cat ${{ steps.setup.outputs.dockerEnvFile }}
  151. docker run --rm \
  152. --network host \
  153. -v /var/run/docker.sock:/var/run/docker.sock \
  154. -v ${{ steps.setup.outputs.outputDir }}:${{ steps.setup.outputs.outputDir }} \
  155. --env-file ${{ steps.setup.outputs.dockerEnvFile }} \
  156. quorumengineering/acctests:latest test \
  157. -Pauto \
  158. -Dauto.outputDir=${{ steps.setup.outputs.outputDir }} \
  159. -Dtags="${{ matrix.tag }}"
  160. - name: 'Debug'
  161. run: |
  162. docker images
  163. docker ps -a