Skip to content

Commit

Permalink
Merge branch '20-implement-github-action-to-build-and-test-project'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvodi committed Aug 31, 2024
2 parents c317279 + 7f87f4e commit 321a9a8
Show file tree
Hide file tree
Showing 67 changed files with 1,265 additions and 780 deletions.
69 changes: 58 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,73 @@

name: Go

env:
GO_VERSION: '1.22.4'

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60

build:
# Label of the runner job
runner-job:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest

# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Create default config
run: cp limepipes.env.default limepipes.env

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Test
run: go test -v ./...
env:
DB_PASSWORD: postgres
DB_USER: postgres
DB_NAME: postgres

- name: Build
run: go build -v ./...


- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.4'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
65 changes: 59 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,63 @@
run:
tests: false
skip-files:
- '.*test_data.go'
tests: true

linters:
enable:
- revive

issues:
exclude-dirs:
- apigen
exclude-rules:
- path: 'internal/bww/bww_grammar.go'
linters:
- govet
- linters:
- revive
source: ". \"github.com/onsi/(ginkgo/v2|gomega)\""
text: "dot-imports: should not use dot imports"

linters-settings:
revive:
enable-all-rules: false
ignore-generated-header: false
severity: error
rules:
- name: argument-limit
arguments: [3]
- name: blank-imports
- name: cognitive-complexity
arguments: [7]
exclude:
- "TEST"
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: early-return
- name: empty-block
- name: error-return
- name: error-strings
- name: error-naming
- name: errorf
- name: exported
- name: function-result-limit
arguments: [3]
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: max-control-nesting
arguments: [3]
- name: modifies-parameter
- name: package-comments
severity: warning
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: struct-tag
- name: superfluous-else
- name: time-equal
- name: time-naming
- name: unexported-return
- name: unhandled-error
- name: unreachable-code
- name: unused-parameter
- name: use-any
- name: var-declaration
- name: var-naming
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ testonly: False
with-expecter: True
packages:
github.com/tomvodi/limepipes/internal/interfaces:
github.com/tomvodi/limepipes/internal/api_gen/interfaces:
github.com/tomvodi/limepipes/internal/apigen/interfaces:
all: True
dir: "{{.InterfaceDir}}/mocks"
outpkg: "mocks"
Expand Down
Loading

0 comments on commit 321a9a8

Please sign in to comment.