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/setup-go@v2
  25. with:
  26. go-version: "1.15"
  27. - uses: actions/checkout@v2
  28. - uses: technote-space/get-diff-action@v4
  29. with:
  30. PATTERNS: |
  31. **/**.go
  32. go.mod
  33. go.sum
  34. - name: install
  35. run: make install install_abci
  36. if: "env.GIT_DIFF != ''"
  37. - uses: actions/cache@v2.1.4
  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.4
  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/setup-go@v2
  56. with:
  57. go-version: "1.15"
  58. - uses: actions/checkout@v2
  59. - uses: technote-space/get-diff-action@v4
  60. with:
  61. PATTERNS: |
  62. **/**.go
  63. go.mod
  64. go.sum
  65. - uses: actions/cache@v2.1.4
  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.4
  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/setup-go@v2
  87. with:
  88. go-version: "1.15"
  89. - uses: actions/checkout@v2
  90. - uses: technote-space/get-diff-action@v4
  91. with:
  92. PATTERNS: |
  93. **/**.go
  94. go.mod
  95. go.sum
  96. - uses: actions/cache@v2.1.4
  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.4
  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/setup-go@v2
  117. with:
  118. go-version: "1.15"
  119. - uses: actions/checkout@v2
  120. - uses: technote-space/get-diff-action@v4
  121. with:
  122. PATTERNS: |
  123. **/**.go
  124. go.mod
  125. go.sum
  126. - uses: actions/cache@v2.1.4
  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.4
  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