## Description The current action workflow skips cause requried actions to be marked as passing until they fail, not marked as incomplete until either passed, failed, or skipped. This change should provide the latter behavior. ## Type of change - [x] 🌻 Feature ## Issue(s) * #744 ## Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
88 lines
2.6 KiB
YAML
88 lines
2.6 KiB
YAML
name: Lint
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
# cancel currently running jobs if a new version of the branch is pushed
|
|
concurrency:
|
|
group: ci-linting-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
precheck:
|
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
|
|
|
Linting:
|
|
needs: precheck
|
|
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
|
|
- name: Local Cache Setup
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
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
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
|
|
- name: Cache Go Mod
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
id: modcache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Download package dependencies
|
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.modcache.outputs.cache-hit != 'true'
|
|
run: go mod download
|
|
|
|
- name: Cache Go build
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
id: gocache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/go-build
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Build for Lint
|
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.gocache.outputs.cache-hit != 'true'
|
|
run: go build ./...
|
|
|
|
- name: Go Lint
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
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
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
run: go install github.com/google/go-licenses@latest
|
|
|
|
- name: Run go-licenses
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src |