You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.9 KiB

  1. name: Tests
  2. # Tests runs different tests (test_abci_apps, test_abci_cli, test_apps)
  3. # This workflow runs on every push to master or release branch and every pull requests
  4. # All jobs will pass without running if no *{.go, .mod, .sum} files have been modified
  5. on:
  6. pull_request:
  7. push:
  8. branches:
  9. - master
  10. - release/**
  11. jobs:
  12. cleanup-runs:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: rokroskar/workflow-run-cleanup-action@master
  16. env:
  17. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  18. if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
  19. build:
  20. name: Build
  21. runs-on: ubuntu-latest
  22. timeout-minutes: 5
  23. steps:
  24. - uses: actions/checkout@v2
  25. - uses: technote-space/get-diff-action@v4
  26. with:
  27. PATTERNS: |
  28. **/**.go
  29. go.mod
  30. go.sum
  31. - name: Set GOBIN
  32. run: |
  33. echo "::add-path::$(go env GOPATH)/bin"
  34. - name: install
  35. run: make install install_abci
  36. if: "env.GIT_DIFF != ''"
  37. - uses: actions/cache@v2.1.2
  38. with:
  39. path: ~/go/pkg/mod
  40. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  41. restore-keys: |
  42. ${{ runner.os }}-go-
  43. if: env.GIT_DIFF
  44. # Cache binaries for use by other jobs
  45. - uses: actions/cache@v2.1.2
  46. with:
  47. path: ~/go/bin
  48. key: ${{ runner.os }}-${{ github.sha }}-tm-binary
  49. if: env.GIT_DIFF
  50. test_abci_apps:
  51. runs-on: ubuntu-latest
  52. needs: Build
  53. timeout-minutes: 5
  54. steps:
  55. - uses: actions/checkout@v2
  56. - uses: technote-space/get-diff-action@v4
  57. with:
  58. PATTERNS: |
  59. **/**.go
  60. go.mod
  61. go.sum
  62. - name: Set GOBIN
  63. run: |
  64. echo "::add-path::$(go env GOPATH)/bin"
  65. - uses: actions/cache@v2.1.2
  66. with:
  67. path: ~/go/pkg/mod
  68. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  69. restore-keys: |
  70. ${{ runner.os }}-go-
  71. if: env.GIT_DIFF
  72. - uses: actions/cache@v2.1.2
  73. with:
  74. path: ~/go/bin
  75. key: ${{ runner.os }}-${{ github.sha }}-tm-binary
  76. if: env.GIT_DIFF
  77. - name: test_abci_apps
  78. run: abci/tests/test_app/test.sh
  79. shell: bash
  80. if: env.GIT_DIFF
  81. test_abci_cli:
  82. runs-on: ubuntu-latest
  83. needs: Build
  84. timeout-minutes: 5
  85. steps:
  86. - uses: actions/checkout@v2
  87. - uses: technote-space/get-diff-action@v4
  88. with:
  89. PATTERNS: |
  90. **/**.go
  91. go.mod
  92. go.sum
  93. - name: Set GOBIN
  94. run: |
  95. echo "::add-path::$(go env GOPATH)/bin"
  96. - uses: actions/cache@v2.1.2
  97. with:
  98. path: ~/go/pkg/mod
  99. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  100. restore-keys: |
  101. ${{ runner.os }}-go-
  102. if: env.GIT_DIFF
  103. - uses: actions/cache@v2.1.2
  104. with:
  105. path: ~/go/bin
  106. key: ${{ runner.os }}-${{ github.sha }}-tm-binary
  107. if: env.GIT_DIFF
  108. - run: abci/tests/test_cli/test.sh
  109. shell: bash
  110. if: env.GIT_DIFF
  111. test_apps:
  112. runs-on: ubuntu-latest
  113. needs: Build
  114. timeout-minutes: 5
  115. steps:
  116. - uses: actions/checkout@v2
  117. - uses: technote-space/get-diff-action@v4
  118. with:
  119. PATTERNS: |
  120. **/**.go
  121. go.mod
  122. go.sum
  123. - name: Set GOBIN
  124. run: |
  125. echo "::add-path::$(go env GOPATH)/bin"
  126. - uses: actions/cache@v2.1.2
  127. with:
  128. path: ~/go/pkg/mod
  129. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  130. restore-keys: |
  131. ${{ runner.os }}-go-
  132. if: env.GIT_DIFF
  133. - uses: actions/cache@v2.1.2
  134. with:
  135. path: ~/go/bin
  136. key: ${{ runner.os }}-${{ github.sha }}-tm-binary
  137. if: env.GIT_DIFF
  138. - name: test_apps
  139. run: test/app/test.sh
  140. shell: bash
  141. if: env.GIT_DIFF