| 1 | name: test |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - main |
| 6 | pull_request: |
| 7 | paths: |
| 8 | - '.github/workflows/test.yml' |
| 9 | - '**Makefile' |
| 10 | - '**.go' |
| 11 | - 'go.mod' |
| 12 | - 'go.sum' |
| 13 | jobs: |
| 14 | build_and_test: |
| 15 | name: test on ubuntu-linux |
| 16 | runs-on: ubuntu-latest |
| 17 | steps: |
| 18 | |
| 19 | - name: Set up Go 1.16 |
| 20 | uses: actions/setup-go@v2 |
| 21 | with: |
| 22 | go-version: 1.16 |
| 23 | id: go |
| 24 | |
| 25 | - name: Check out code |
| 26 | uses: actions/checkout@v2 |
| 27 | |
| 28 | - uses: actions/cache@v2 |
| 29 | with: |
| 30 | path: ~/go/pkg/mod |
| 31 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 32 | restore-keys: | |
| 33 | ${{ runner.os }}-go- |
| 34 | |
| 35 | - name: Run unit tests |
| 36 | run: make test |