mirror of
https://github.com/romdo/go-validate.git
synced 2026-02-18 23:56:41 +00:00
ci(github): add GitHub Actions CI workflow
A few common workflows I normally use are commented out for now, I will add them at a later date.
This commit is contained in:
145
.github/workflows/ci.yml
vendored
Normal file
145
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
---
|
||||
name: CI
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.42
|
||||
env:
|
||||
VERBOSE: "true"
|
||||
|
||||
tidy:
|
||||
name: Tidy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Check if mods are tidy
|
||||
run: make check-tidy
|
||||
|
||||
# benchmark:
|
||||
# name: Benchmarks
|
||||
# runs-on: ubuntu-latest
|
||||
# if: github.ref != 'refs/heads/main'
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: actions/setup-go@v2
|
||||
# with:
|
||||
# go-version: 1.15
|
||||
# - uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-go-
|
||||
# - name: Run benchmarks
|
||||
# run: make bench | tee output.raw
|
||||
# - name: Fix benchmark names
|
||||
# run: >-
|
||||
# perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
||||
# tr '-' '_' | tee output.txt
|
||||
# - name: Announce benchmark result
|
||||
# uses: rhysd/github-action-benchmark@v1
|
||||
# with:
|
||||
# tool: "go"
|
||||
# output-file-path: output.txt
|
||||
# fail-on-alert: true
|
||||
# comment-on-alert: true
|
||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# auto-push: false
|
||||
|
||||
# cov:
|
||||
# name: Coverage
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: actions/setup-go@v2
|
||||
# with:
|
||||
# go-version: 1.15
|
||||
# - uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-go-
|
||||
# - name: Publish coverage
|
||||
# uses: paambaati/codeclimate-action@v2.7.4
|
||||
# env:
|
||||
# VERBOSE: "true"
|
||||
# GOMAXPROCS: 4
|
||||
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
# with:
|
||||
# coverageCommand: make cov
|
||||
# prefix: github.com/${{ github.repository }}
|
||||
# coverageLocations: |
|
||||
# ${{ github.workspace }}/coverage.out:gocov
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
go_version:
|
||||
- "1.15"
|
||||
- "1.16"
|
||||
- "1.17"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.terraform_version }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Run tests
|
||||
run: make test
|
||||
env:
|
||||
VERBOSE: "true"
|
||||
# benchmark-store:
|
||||
# name: Store benchmarks
|
||||
# runs-on: ubuntu-latest
|
||||
# if: github.ref == 'refs/heads/main'
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: actions/setup-go@v2
|
||||
# with:
|
||||
# go-version: 1.15
|
||||
# - uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-go-
|
||||
# - name: Run benchmarks
|
||||
# run: make bench | tee output.raw
|
||||
# - name: Fix benchmark names
|
||||
# run: >-
|
||||
# perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
||||
# tr '-' '_' | tee output.txt
|
||||
# - name: Store benchmark result
|
||||
# uses: rhysd/github-action-benchmark@v1
|
||||
# with:
|
||||
# tool: "go"
|
||||
# output-file-path: output.txt
|
||||
# github-token: ${{ secrets.ROMDOBOT_TOKEN }}
|
||||
# comment-on-alert: true
|
||||
# auto-push: true
|
||||
@@ -86,6 +86,12 @@ issues:
|
||||
- source: "`json:"
|
||||
linters:
|
||||
- lll
|
||||
- source: "`yaml:"
|
||||
linters:
|
||||
- lll
|
||||
- source: "`form:"
|
||||
linters:
|
||||
- lll
|
||||
|
||||
run:
|
||||
timeout: 2m
|
||||
|
||||
Reference in New Issue
Block a user