Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
indent_style = tab
indent_size = 4

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.{json,md}]
indent_style = space
indent_size = 2

[*.sh]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[Dockerfile*]
indent_style = space
indent_size = 2
48 changes: 48 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Auto detect text files and perform LF normalization
* text=auto

# Go files
*.go text eol=lf

# Configuration files
*.yml text eol=lf
*.yaml text eol=lf
*.json text eol=lf
*.toml text eol=lf

# Markdown files
*.md text eol=lf

# Shell scripts
*.sh text eol=lf

# Dockerfile
Dockerfile text eol=lf

# Documentation
LICENSE text eol=lf
README* text eol=lf

# Binary files
*.exe binary
*.dll binary
*.so binary
*.dylib binary

# Archives
*.zip binary
*.tar binary
*.gz binary
*.7z binary

# Images
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.svg binary

# Go specific
go.mod text eol=lf
go.sum text eol=lf
16 changes: 0 additions & 16 deletions .github/actions/build/action.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/actions/cd/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Binary

description: Build the Go binary

inputs:
output:
description: Name of the output binary file
required: false
default: moley

runs:
using: "composite"
steps:
- name: Download dependencies
run: go mod download
shell: bash

- name: Build binary
run: go build -o ${{ inputs.output }} .
shell: bash
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: Test, Vet, Fmt
name: Lint

description: Run Go tests, vet, and formatting checks
description: Run Go linting and formatting checks

runs:
using: "composite"
steps:
- name: Install dependencies
- name: Download dependencies
run: go mod download
shell: bash
- name: Run tests
run: go test -v ./...
shell: bash

- name: Run go vet
run: go vet ./...
shell: bash
- name: Run go fmt check

- name: Check formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Code is not formatted. Run 'go fmt ./...'"
gofmt -s -l .
exit 1
fi
shell: bash
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/ci/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test

description: Run Go tests

runs:
using: "composite"
steps:
- name: Download dependencies
run: go mod download
shell: bash

- name: Run tests
run: go test -v ./...
shell: bash
11 changes: 6 additions & 5 deletions .github/workflows/release.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Release

on:
push:
tags:
- 'v*'

tags: ['v*']

permissions:
contents: write
packages: write
Expand All @@ -20,6 +19,8 @@ jobs:

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -28,11 +29,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser to build and release
- name: Release with GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.23', '1.24']
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Run tests
uses: ./.github/actions/ci/test

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run linting
uses: ./.github/actions/ci/lint
21 changes: 0 additions & 21 deletions .github/workflows/test.yml

This file was deleted.

Loading