ci(build-test): Add golangci-lint to do import checking and other lin… #125
This file contains 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
# SPDX-License-Identifier: Apache-2.0 | |
name: PR Build Check | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
jobs: | |
golangci: | |
name: Code Linting (ubuntu-latest) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59 | |
build: | |
name: Build and Test (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.18' | |
cache: true | |
- name: Build | |
run: go build ./... | |
- name: Run Tests | |
if: runner.os != 'Linux' | |
run: go test -v ./... | |
- name: Run Tests with Coverage | |
if: runner.os == 'Linux' | |
run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /proto) | |
- name: Upload coverage to Codecov | |
if: runner.os == 'Linux' && github.repository == 'substrait-io/substrait-go' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
disable_search: true | |
file: ./coverage.out | |
fail_ci_if_error: true |