github.com/Finschia/ostracon@v1.1.5/.github/workflows/abci.yml (about)

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