feat: add linter to CI #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| go-tests: | |
| name: Running Go tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.17' | |
| cache-dependency-path: ./go.mod | |
| - name: Tests | |
| run: go test -v $(go list ./...) | |
| frontend: | |
| name: Front-end | |
| runs-on: ubuntu-latest | |
| needs: [ go-tests ] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| cache-dependency-path: ./web/yarn.lock | |
| - name: Build | |
| run: | | |
| yarn install | |
| GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true npx craco build | |
| working-directory: ./web | |
| env: | |
| CI: false | |
| backend: | |
| name: Back-end | |
| runs-on: ubuntu-latest | |
| needs: [ go-tests ] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.17' | |
| cache-dependency-path: ./go.mod | |
| - run: go version | |
| - name: Build | |
| run: | | |
| go build -race -ldflags "-extldflags '-static'" | |
| working-directory: ./ | |
| linter: | |
| name: Go-Linter | |
| runs-on: ubuntu-latest | |
| needs: [ go-tests ] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.17' | |
| cache: false | |
| # gen a dummy config file | |
| - run: touch dummy.yml | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v3 | |
| with: | |
| version: latest | |
| args: --disable-all -c dummy.yml -E=gofumpt --max-same-issues=0 --timeout 5m --modules-download-mode=mod |