Skip to content

Commit

Permalink
chore: introduce .github
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Mar 29, 2024
1 parent f75f6c3 commit 6ec070c
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
60 changes: 60 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: mev-commit-ci

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache Modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
**/go.work.sum # Add this line to include go.work.sum in the cache path
key: ${{ runner.os }}-go-${{ hashFiles('**/go.work.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Workspace Modules
run: |
echo $(go list -f '{{.Dir}}' -m)
echo "GO_LINT_DIRS=$(go list -f '{{.Dir}}/...' -m | tr '\n' ' ')" >> $GITHUB_ENV
- name: Tidy
run: go list -f '{{.Dir}}' -m | xargs -L1 go mod tidy -C

- name: Sync
run: go work sync

- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
only-new-issues: true
args: --verbose ${{ env.GO_LINT_DIRS }}

- name: Build
run: go list -f '{{.Dir}}/...' -m | xargs go build

- name: Test
run: go list -f '{{.Dir}}/...' -m | xargs go test -v

27 changes: 27 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
linters-settings:
gofmt:
simplify: true
gocritic:
enabled-tags:
- style
- performance
errcheck:
check-type-assertions: true
check-blank: true

linters:
presets:
- sql
- test
- bugs
- style
- format
- import
- unused
- comment
- complexity
- performance

run:
timeout: 5m
concurrency: 4

0 comments on commit 6ec070c

Please sign in to comment.