| 1 | name: Continuous Integration |
| 2 | |
| 3 | env: |
| 4 | GO_VERSION: 1.18 |
| 5 | |
| 6 | on: |
| 7 | push: |
| 8 | branches: |
| 9 | - master |
| 10 | pull_request: |
| 11 | |
| 12 | jobs: |
| 13 | unit-tests: |
| 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | os: |
| 18 | - ubuntu-latest |
| 19 | - windows-latest |
| 20 | include: |
| 21 | - os: ubuntu-latest |
| 22 | cache_path: ~/.cache/go-build |
| 23 | - os: windows-latest |
| 24 | cache_path: ~\AppData\Local\go-build |
| 25 | name: ci - ${{matrix.os}} |
| 26 | runs-on: ${{matrix.os}} |
| 27 | steps: |
| 28 | - name: Checkout code |
| 29 | uses: actions/checkout@v2 |
| 30 | - name: Setup Go |
| 31 | uses: actions/setup-go@v1 |
| 32 | with: |
| 33 | go-version: 1.18.x |
| 34 | - name: Cache build |
| 35 | uses: actions/cache@v3 |
| 36 | with: |
| 37 | path: | |
| 38 | ${{matrix.cache_path}} |
| 39 | ~/go/pkg/mod |
| 40 | key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-test |
| 41 | restore-keys: | |
| 42 | ${{runner.os}}-go- |
| 43 | - name: Test code |
| 44 | run: | |
| 45 | go test ./... |
| 46 | lint: |
| 47 | runs-on: ubuntu-latest |
| 48 | steps: |
| 49 | - name: Checkout code |
| 50 | uses: actions/checkout@v2 |
| 51 | - name: Setup Go |
| 52 | uses: actions/setup-go@v1 |
| 53 | with: |
| 54 | go-version: 1.18.x |
| 55 | - name: Cache build |
| 56 | uses: actions/cache@v1 |
| 57 | with: |
| 58 | path: | |
| 59 | ~/.cache/go-build |
| 60 | ~/go/pkg/mod |
| 61 | key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-test |
| 62 | restore-keys: | |
| 63 | ${{runner.os}}-go- |
| 64 | - name: Lint |
| 65 | uses: golangci/[email protected] |
| 66 | with: |
| 67 | version: latest |
| 68 | - name: errors |
| 69 | run: golangci-lint run |
| 70 | if: ${{ failure() }} |