Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vearne committed May 13, 2024
1 parent 8267c5f commit 1f72d0a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/golang-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: golang-ci

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
container:
image: golangci/golangci-lint:v1.54.0
steps:
- name: checkout
uses: actions/checkout@v4
- name: golangci-lint
run: golangci-lint run --modules-download-mode=mod

build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: build broker
run: go build -o chat-broker ./cmd/broker
- name: build logic
run: go build -o chat-logic ./cmd/logic
25 changes: 25 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
linters:
disable-all: true
enable:
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
- gosimple # Linter for Go source code that specializes in simplifying a code
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # Detects when assignments to existing variables are not used
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unused # Checks Go code for unused constants, variables, functions and types
- exportloopref

linters-settings:
govet:
enable-all: true
check-shadowing: true
disable:
- fieldalignment

run:
skip-dirs:
- scripts
- test
- example
- cmd

0 comments on commit 1f72d0a

Please sign in to comment.