.github/workflows/ci.yml
name: CI
on:
push:
branches: [ 'main' ]
pull_request:
jobs:
lint:
name: Validate source code with linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
skip-cache: true
test:
name: Run the tests suite
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run tests with coverage
run: make cover
- name: Report coverage to CodeCov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.out
flags: unittests
env_vars: OS
- name: Report coverage to CodeClimate
uses: paambaati/codeclimate-action@v3.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
prefix: github.com/go-gremlins/gremlins
coverageLocations: |
${{github.workspace}}/coverage.out:gocov
- name: Report coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.out
language: go
force-coverage-parser: go