Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Go Build
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Build
uses: actions/setup-go@v5
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
go-version: '^1.26.0'
- run: |
cd cmd/rdap
go build -o rdap
Comment thread
coderabbitai[bot] marked this conversation as resolved.
32 changes: 0 additions & 32 deletions .github/workflows/go.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Lint
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".golangci.yml"

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

# Deny all token scopes by default; the lint job escalates only what it needs.
permissions: {}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
# Allow lint annotations in the PR.
pull-requests: read

steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- uses: actions/setup-go@v5
with:
go-version: '^1.26.0'
Comment thread
wolveix marked this conversation as resolved.

- name: Download dependencies
run: go mod download

- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest

- name: Format code
run: gofumpt -w .

- name: Run golangci-lint (fix)
uses: golangci/golangci-lint-action@v9
with:
args: --fix --issues-exit-code=0 --timeout=5m
install-mode: goinstall
version: latest

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
commit_message: "chore: apply linter fixes and formatting"

- name: Run golangci-lint (check)
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m
install-mode: goinstall
version: latest
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests (Unit)
on:
pull_request:
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: read

jobs:
tests-unit:
name: Tests (Unit)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 1.25.x is the floor declared in go.mod; 1.26.x is the latest release.
# Testing both ensures the declared minimum stays buildable while the
# latest toolchain is exercised.
go-version: ['1.25.x', '1.26.x']

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

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

Comment thread
wolveix marked this conversation as resolved.
- name: Download dependencies
run: go mod download

- name: Run tests
run: |
go test -race -coverprofile=coverage.out ./...
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
echo "Total coverage: $coverage%"
if (( $(echo "$coverage < 50" | bc -l) )); then
echo "Coverage $coverage% is below 50% threshold"
exit 1
fi
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.*.un~
*.DS_Store
*.log
.idea/*
.vscode/*
Loading
Loading