swaps the corso go module from github.com/ alcionai/corso to github.com/alcionai/corso/src to align with the location of the go.mod and go.sum files inside the repo. All other changes in the repository update the package imports to the new module path.
70 lines
1.7 KiB
YAML
70 lines
1.7 KiB
YAML
name: Lint
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
Linting:
|
|
environment: Testing
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
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
|
|
skip-build-cache: true
|
|
skip-go-installation: 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/src --ignore github.com/alcionai/corso/src |