64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: Lint
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
Linting:
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- name: Checkout src code
|
|
uses: actions/checkout@v3
|
|
|
|
# Get values for cache paths to be used in later steps
|
|
- id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Golang Setup
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
|
|
- name: Cache Go Mod
|
|
uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Download package dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: go mod download
|
|
|
|
- name: Cache Go build
|
|
uses: actions/cache@v3
|
|
id: mybuild
|
|
with:
|
|
path: ~/.cache/go-build
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Build for Lint
|
|
if: steps.mybuild.outputs.cache-hit != 'true'
|
|
run: go build ./...
|
|
|
|
- name: Go Lint
|
|
uses: golangci/golangci-lint-action@v3.2.0
|
|
with:
|
|
version: v1.45.2
|
|
working-directory: ./src
|
|
skip-pkg-cache: true
|
|
|
|
# check licenses
|
|
- name: Get go-licenses
|
|
run: go install github.com/google/go-licenses@latest
|
|
|
|
- name: Run go-licenses
|
|
run: go-licenses check github.com/alcionai/corso --ignore github.com/alcionai/corso |