Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9ea7bcc
Fix code formatting issues in PR #12
bluet May 30, 2025
87c284c
Add comprehensive CI/CD setup with code formatting checks
bluet May 30, 2025
661b8d8
Add .dccache to gitignore
bluet May 30, 2025
bebb04a
Fix security and functionality issues from PR review
bluet May 30, 2025
88b4d58
Focus on package manager tools instead of OS-specific detection
bluet May 30, 2025
4153e7b
Add project documentation and testing infrastructure
bluet May 30, 2025
d8b0128
Update documentation to reflect current state and tool-focused philos…
bluet May 30, 2025
de93361
Update Go version to 1.24.3 (latest stable)
bluet May 30, 2025
dfe09f0
Remove outdated .go-version file
bluet May 30, 2025
a9a8ca0
Apply code formatting (gofmt + goimports)
bluet May 30, 2025
96e1aa9
Fix TestParseFindOutput package ordering issue
bluet May 30, 2025
41a0985
remove temp file
bluet May 30, 2025
7275ffe
Fix non-deterministic package ordering in ParseFindOutput
bluet May 30, 2025
58ebcd4
Fix documentation issues found in PR review
bluet May 30, 2025
552392e
Fix remaining nitpick issues from PR review
bluet May 30, 2025
2391ec2
Fix Go version in .tool-versions
bluet May 30, 2025
432aa6e
Revert Go version - 1.24.3 was correct
bluet May 30, 2025
9aac6b2
Align Go version requirements with .tool-versions
bluet May 30, 2025
b4ff570
Update CI workflows and go.mod to Go 1.23/1.24
bluet May 30, 2025
4f4e365
Modernize development infrastructure and documentation
bluet May 30, 2025
6a4ac33
Upgrade to Apache License 2.0 and enhance README badges
bluet May 30, 2025
89b0b4a
Sync all documentation with latest project status
bluet May 30, 2025
1bde898
Address PR #13 review comments
bluet May 30, 2025
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
80 changes: 80 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# CI/CD Workflows

This directory contains GitHub Actions workflows for the go-syspkg project.

## Workflows

### 1. Test and Coverage (`test-and-coverage.yml`)
Runs comprehensive tests with coverage reporting:
- **Go Versions**: 1.23, 1.24 (project requires Go 1.23+)
- **Platform**: Ubuntu Latest
- **Coverage**: Uploads test coverage to Codecov
- **Race Detection**: Runs tests with race detector enabled

### 2. Lint and Format (`lint-and-format.yml`)
Ensures code quality and formatting standards:
- **gofmt**: Checks code formatting
- **go vet**: Reports suspicious constructs
- **golangci-lint**: Comprehensive linting with multiple linters
- **go mod tidy**: Ensures go.mod and go.sum are up to date

### 3. Build (`build.yml`)
Verifies code builds across Go versions:
- **Go Versions**: 1.23, 1.24
- **Build Targets**: All packages and CLI binary
- **Platform**: Ubuntu Latest

### 4. Release Binaries (`release-binaries.yml`)
Creates cross-platform release binaries:
- **Platforms**: Linux, Windows, Darwin
- **Architectures**: amd64, arm64, 386 (where supported)
- **Go Version**: 1.24
- **Trigger**: On GitHub releases

## Local Development

### Running Checks Locally
```bash
# Format code
make format

# Check formatting and run linters
make check

# Run specific checks
gofmt -l . # List files that need formatting
go vet ./... # Run go vet
golangci-lint run # Run all linters
```

### Pre-commit Hooks
Install pre-commit to run checks automatically before commits:
```bash
pre-commit install
```

Pre-commit hooks include:
- File hygiene (trailing whitespace, EOF, merge conflicts)
- Go tools (gofmt, goimports, go vet, go mod tidy, golangci-lint)
- Build verification (go build, go mod verify)
- Security-focused using local system tools only

## Configuration Files

- `.golangci.yml`: Configures golangci-lint with enabled/disabled linters
- `.pre-commit-config.yaml`: Defines pre-commit hooks
- `Makefile`: Contains format and check targets

## Adding New Checks

To add new linting rules:
1. Update `.golangci.yml` to enable/disable linters
2. Update the `lint-and-format.yml` workflow if needed
3. Test locally with `make check`

## Project Standards

- **License**: Apache License 2.0 (patent protection and enterprise clarity)
- **Go Version**: 1.23+ required, CI tests with 1.23 and 1.24
- **Code Quality**: Enforced via pre-commit hooks and CI workflows
- **Security**: Local system tools used in pre-commit for maximum security
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build

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

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.23', '1.24']

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

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

- name: Install dependencies
run: go mod download

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

- name: Build CLI binary
run: go build -v ./cmd/syspkg
28 changes: 0 additions & 28 deletions .github/workflows/go.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Lint and Format

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

permissions:
contents: read

jobs:
lint:
name: Lint and Format Check
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true

- name: Install dependencies
run: |
go mod download
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

- name: Run gofmt
run: |
# Check if gofmt reports any formatting issues
if [ -n "$(gofmt -l .)" ]; then
echo "The following files need formatting:"
gofmt -l .
echo ""
echo "Please run 'gofmt -w .' to format your code"
exit 1
fi

- name: Run go vet
run: go vet ./...

- name: Run golangci-lint
run: golangci-lint run --timeout=5m

- name: Run go mod tidy check
run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]; then
echo "go mod tidy produced changes:"
git diff
echo ""
echo "Please run 'go mod tidy' and commit the changes"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# .github/workflows/go-release-binaries.yml
name: Go Release Binaries
name: Release Binaries

on:
release:
types: [created]

permissions:
contents: write

jobs:
releases-matrix:
name: Release Go Binary
Expand All @@ -19,22 +23,24 @@ jobs:
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.24'
cache: true

- name: Install dependencies
run: go mod download

- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: https://dl.google.com/go/go1.20.3.linux-amd64.tar.gz
go_version: '1.24'
project_path: ./cmd/syspkg
binary_name: syspkg
extra_files: LICENSE README.md

44 changes: 44 additions & 0 deletions .github/workflows/test-and-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test and Coverage

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

permissions:
contents: read

jobs:
test:
name: Test and Coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
go-version: ['1.23', '1.24']

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

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

- name: Install dependencies
run: go mod download

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

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.23'
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
flags: unittests
name: codecov-umbrella
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@ go.work

bin/
tmp/
**/*.log
**/*.log.dccache

# Development cache and temporary files
.dccache
*.log

# Temporary development notes (not part of official docs)
*_improvements.md
*_notes.md
*_todo.md
2 changes: 0 additions & 2 deletions .go-version

This file was deleted.

Loading