Skip to content
Open
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
35 changes: 35 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
coverage:
precision: 2
round: down
range: "80...100"
status:
project:
default:
target: 80%
threshold: 5%
base: auto
patch:
default:
target: 80%
threshold: 5%
base: auto

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false

ignore:
- "cmd/main.go"
- "tests/"
- "**/*_test.go"
- "internal/services/stub_services.go"
- "demo_*.go"
39 changes: 39 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: 2
updates:
# Enable version updates for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 10
reviewers:
- "TuringProblem"
assignees:
- "TuringProblem"
commit-message:
prefix: "deps"
include: "scope"
labels:
- "dependencies"
- "go"

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 5
reviewers:
- "TuringProblem"
assignees:
- "TuringProblem"
commit-message:
prefix: "ci"
include: "scope"
labels:
- "dependencies"
- "github-actions"
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
GO_VERSION: '1.21'
CGO_ENABLED: 0

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.21, 1.22]

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

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

- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Install dependencies
run: go mod download

- name: Run tests with coverage
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go test -v -race -coverprofile=coverage.out -covermode=atomic ./tests/...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest

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

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

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m

build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]

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

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

- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -v -ldflags="-s -w" -o clisland-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/main.go

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: clisland-${{ matrix.goos }}-${{ matrix.goarch }}
path: clisland-${{ matrix.goos }}-${{ matrix.goarch }}

security:
name: Security Scan
runs-on: ubuntu-latest

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

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

- name: Run gosec security scanner
uses: securecodewarrior/github-action-gosec@master
with:
args: '-fmt sarif -out results.sarif ./...'

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: results.sarif
26 changes: 26 additions & 0 deletions .github/workflows/qulty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: QLTY.dev Analysis

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
qulty:
name: QLTY.dev Analysis
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: QLTY.dev Analysis
uses: qulty-dev/github-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Optional: Add your QLTY.dev API key if you have one
# api_key: ${{ secrets.QLTY_API_KEY }}
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on:
push:
tags:
- 'v*'

env:
GO_VERSION: '1.21'
CGO_ENABLED: 0

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Build for multiple platforms
env:
CGO_ENABLED: 0
run: |
VERSION=${GITHUB_REF#refs/tags/}

# Build for different platforms
GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-linux-amd64 ./cmd/main.go
GOOS=linux GOARCH=arm64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-linux-arm64 ./cmd/main.go
GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-darwin-amd64 ./cmd/main.go
GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-darwin-arm64 ./cmd/main.go
GOOS=windows GOARCH=amd64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-windows-amd64.exe ./cmd/main.go
GOOS=windows GOARCH=arm64 go build -v -ldflags="-s -w -X main.version=$VERSION" -o clisland-windows-arm64.exe ./cmd/main.go

- name: Create checksums
run: |
sha256sum clisland-* > checksums.txt

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
clisland-*
checksums.txt
generate_release_notes: true
draft: false
prerelease: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ dist/
build/
*.o
*.a
clisland
clisland-*
checksums.txt

# Environment files
.env
Expand Down
Loading
Loading