|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "*" |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + |
| 15 | +env: |
| 16 | + GO_VERSION: 1.16.x |
| 17 | + |
| 18 | +jobs: |
| 19 | + ######################## |
| 20 | + # compilation check |
| 21 | + ######################## |
| 22 | + rpc-check: |
| 23 | + name: RPC and mobile compilation check |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: git checkout |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: setup go ${{ env.GO_VERSION }} |
| 30 | + uses: actions/setup-go@v2 |
| 31 | + with: |
| 32 | + go-version: '${{ env.GO_VERSION }}' |
| 33 | + |
| 34 | + - name: run check |
| 35 | + run: make build |
| 36 | + |
| 37 | + ######################## |
| 38 | + # lint code |
| 39 | + ######################## |
| 40 | + lint: |
| 41 | + name: lint code |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - name: git checkout |
| 45 | + uses: actions/checkout@v2 |
| 46 | + |
| 47 | + - name: Fetch all history for linter |
| 48 | + run: git fetch --prune --unshallow |
| 49 | + |
| 50 | + - name: setup go ${{ env.GO_VERSION }} |
| 51 | + uses: actions/setup-go@v2 |
| 52 | + with: |
| 53 | + go-version: '${{ env.GO_VERSION }}' |
| 54 | + |
| 55 | + - name: lint |
| 56 | + run: make lint |
| 57 | + |
| 58 | + ######################## |
| 59 | + # run unit tests |
| 60 | + ######################## |
| 61 | + unit-test: |
| 62 | + name: run unit tests |
| 63 | + runs-on: ubuntu-latest |
| 64 | + strategy: |
| 65 | + # Allow other tests in the matrix to continue if one fails. |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + unit_type: |
| 69 | + - unit-cover |
| 70 | + - unit-race |
| 71 | + steps: |
| 72 | + - name: git checkout |
| 73 | + uses: actions/checkout@v2 |
| 74 | + |
| 75 | + - name: setup go ${{ env.GO_VERSION }} |
| 76 | + uses: actions/setup-go@v2 |
| 77 | + with: |
| 78 | + go-version: '${{ env.GO_VERSION }}' |
| 79 | + |
| 80 | + - name: run ${{ matrix.unit_type }} |
| 81 | + run: make ${{ matrix.unit_type }} |
| 82 | + |
| 83 | + - name: Send coverage |
| 84 | + uses: shogo82148/actions-goveralls@v1 |
| 85 | + if: matrix.unit_type == 'unit-cover' |
| 86 | + with: |
| 87 | + path-to-profile: coverage.txt |
| 88 | + parallel: true |
0 commit comments