Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a609aa8
build: initialize project and add CI/CD workflow
Oct 28, 2025
6dad788
feat: add basic note entity structure and tests
Oct 28, 2025
9771dd5
Merge pull request #1 from RD2W/feature/structs-study
RD2W Oct 28, 2025
8e8b161
feat: add slice storage and interface-based distribution
RD2W Oct 28, 2025
0e3221b
refactor: move Entity interface to repository package
RD2W Oct 30, 2025
e094d1e
Merge pull request #2 from RD2W/feature/interface-study
RD2W Oct 30, 2025
d1034df
feat: implement goroutines and channels for concurrent processing
RD2W Oct 31, 2025
03f495b
refactor: extract magic numbers and strings to constants
RD2W Oct 31, 2025
38ab3c4
fix: resolve data race in logger tests
RD2W Oct 31, 2025
fe65648
feat: implement concurrent data processing with three goroutines and …
RD2W Nov 3, 2025
1a7f12e
test: fix TestService_ChannelBlocking assertion message
RD2W Nov 3, 2025
8c4f554
Merge pull request #3 from RD2W/feature/goroutines-and-channels-study
RD2W Nov 4, 2025
6250623
feat: implement graceful shutdown with context and OS signals
RD2W Nov 4, 2025
af2c0ec
refactor: extract constants and remove unused ones
RD2W Nov 6, 2025
3af007a
Merge pull request #4 from RD2W/feature/graceful-shutdown-study
RD2W Nov 7, 2025
39e1198
feat: implement concurrent note generation with persistent JSON storage
RD2W Nov 7, 2025
71aadd2
refactor(note): change ID generation to use UUID
RD2W Nov 7, 2025
fbb39aa
test: improve test coverage for app
RD2W Nov 7, 2025
17a8d3f
refactor(json_repository): modify logic to prevent logging loaded not…
RD2W Nov 8, 2025
ce10c29
Merge pull request #5 from RD2W/feature/rw-files-study
RD2W Nov 8, 2025
2653358
ci: update github golangci-lint-action to v9
RD2W Nov 9, 2025
7403d8e
feat: add gRPC and web servers with JWT auth and Swagger documentation
RD2W Nov 9, 2025
fce4df9
refactor: replace timestamp-based JSON files with fixed names
RD2W Nov 9, 2025
7c71330
feat: implement graceful shutdown for web server
RD2W Nov 9, 2025
44fe511
docs: add detailed project description and API usage examples to README
RD2W Nov 9, 2025
1acfdc5
fix: correct curl example in README for creating notes
RD2W Nov 9, 2025
b355235
test: add comprehensive test coverage for handlers, middleware, model…
RD2W Nov 9, 2025
af68501
ci: update Go to 1.25.4 and fix caching issue
RD2W Nov 9, 2025
31d3674
Merge pull request #6 from RD2W/feature/rest-api-study
RD2W Nov 12, 2025
36cab71
feat: implement auth system with JWT, gRPC API, and config management
RD2W Nov 12, 2025
39ba70c
refactor(auth): implement blacklist-only token storage for revoked to…
RD2W Nov 13, 2025
270df0e
Merge pull request #7 from RD2W/feature/auth-study
RD2W Nov 19, 2025
c61d320
refactor: improvement app structure and fix Swagger basePath issue
RD2W Nov 19, 2025
79fe772
refactor: improvement app architecture and package structure
RD2W Nov 19, 2025
ec857c2
feat: implement Redis storage for revoked tokens
RD2W Nov 19, 2025
55955a2
feat: implement PostgreSQL storage for Entity
RD2W Nov 20, 2025
4ba97de
refactor: move Redis client to database package and update imports
RD2W Nov 20, 2025
5a1c99a
test: add integration tests for Redis and PostgreSQL repos
RD2W Nov 20, 2025
756a312
fix: ensure proper closing of Redis connections
RD2W Nov 21, 2025
7e3fe6e
feat: add gRPC interceptor for token validation and improve client tests
RD2W Nov 21, 2025
95aeb09
fix: add security annotations to protected API routes in Swagger doc
RD2W Nov 21, 2025
d9c76b5
test: add comprehensive web server integration tests
RD2W Nov 21, 2025
584cb28
test: refactor auth middleware tests with comprehensive coverage
RD2W Nov 21, 2025
ccbf9e1
test: enhance gRPC client with improved error handling and comprehens…
RD2W Nov 21, 2025
0893d30
test: add tests for config package and fix loadFromEnv method
RD2W Nov 21, 2025
1b52999
test: add lifecycle tests for startup and shutdown functions
RD2W Nov 21, 2025
50457cc
test: add comprehensive tests for domain models
RD2W Nov 21, 2025
b2ba0aa
test: add comprehensive tests for auth service
RD2W Nov 21, 2025
402779b
test: add comprehensive tests for user service
RD2W Nov 21, 2025
9e021fe
test: add comprehensive tests for note service
RD2W Nov 21, 2025
c031b8a
test: add comprehensive tests for user handler
RD2W Nov 21, 2025
2be5fd2
test: add comprehensive tests for note handler
RD2W Nov 21, 2025
3359932
test: add comprehensive tests for auth handler
RD2W Nov 21, 2025
3d14e93
test: add comprehensive tests for grpc delivery
RD2W Nov 21, 2025
62a32c1
test: add performance benchmarks and load tests
RD2W Nov 21, 2025
5478a07
feat: enhance migration script and add Docker DB setup targets to Mak…
RD2W Nov 21, 2025
2979f49
docs: update README.md
RD2W Nov 21, 2025
8c1308b
test: fix unchecked error returns in test files
RD2W Nov 21, 2025
7183657
Merge pull request #8 from RD2W/feature/testing-study
RD2W Nov 25, 2025
d91d012
refactor(postgres): extract error constants to separate package
RD2W Nov 26, 2025
abdc725
refactor(postgres): implement common base repo structure and transact…
RD2W Nov 28, 2025
7ae45b2
feat(database): add database cleanup functionality with rollback support
RD2W Nov 28, 2025
de7549c
fix: HTTP server startup errors and improve signal handling in tests"
RD2W Nov 21, 2025
4a314b0
Merge pull request #9 from RD2W/feature/sql-db-study
RD2W Nov 30, 2025
53ac1ff
feat(systemd): add systemd service files for gRPC and web servers
RD2W Dec 3, 2025
c0a532a
feat: add versioning info to Web and gRPC server main files
RD2W Dec 3, 2025
b121292
build: add Docker support and CI/CD config for gRPC and Web servers
RD2W Dec 6, 2025
c85fb7a
Merge pull request #10 from RD2W/feature/docker-study
RD2W Dec 6, 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
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Исключаем файлы и директории, не нужные для сборки
.git
.gitignore
README.md
LICENSE
*.md
test/
data/
dist/
Dockerfile*
.dockerignore
.releaserc
.github/
.idea/
.vscode/
*.local
*.tmp
*.log
.DS_Store
153 changes: 153 additions & 0 deletions .github/workflows/branch_merges.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: CI/CD Pipeline for Branch Merges

on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main, dev]

jobs:
branch-validation:
name: Validate Branch Compatibility
runs-on: ubuntu-latest
# Проверяем, что PR идёт в main или dev
if: github.base_ref == 'main' || github.base_ref == 'dev'
outputs:
valid: ${{ steps.validate.outputs.valid }}
# Определяем, какие ветки допустимы в зависимости от целевой ветки
steps:
- name: Check branch compatibility
id: validate
run: |
TARGET=${{ github.base_ref }}
SOURCE=${{ github.head_ref }}
echo "➡️ Target branch: $TARGET"
echo "⬅️ Source branch: $SOURCE"

if [[ "$TARGET" == "main" && "$SOURCE" != "dev" ]]; then
echo "❌ PR from '$SOURCE' to 'main' is not allowed. Only 'dev' can be merged into 'main'."
echo "valid=false" >> $GITHUB_OUTPUT
exit 1
fi

if [[ "$TARGET" == "dev" && ! "$SOURCE" =~ ^(feature/.*|feat/.*|bugfix/.*)$ ]]; then
echo "❌ PR from '$SOURCE' to 'dev' is not allowed. Only feature/* or bugfix/* can be merged into 'dev'."
echo "valid=false" >> $GITHUB_OUTPUT
exit 1
fi

echo "✅ Branch compatibility check passed."
echo "valid=true" >> $GITHUB_OUTPUT

# Job для линтинга
lint:
name: Run Linter
runs-on: ubuntu-latest
needs: branch-validation
if: needs.branch-validation.outputs.valid == 'true'

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.4'
cache: false

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
#install-mode: goinstall
version: latest
args: --timeout=5m --verbose
skip-cache: false

# Job для тестов
test:
name: Run Tests
runs-on: ubuntu-latest
needs: branch-validation
if: needs.branch-validation.outputs.valid == 'true'

strategy:
matrix:
go-version: ['1.25.4']
os: [ubuntu-latest]

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}

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

- name: Run comprehensive tests
run: |
go test -v -race -coverprofile=coverage.out ./internal/...
go tool cover -func=coverage.out
go tool cover -html=coverage.out -o coverage.html

- name: Upload coverage report
uses: actions/upload-artifact@v5
with:
name: coverage-report
path: coverage.html

# Job для сборки приложения
build:
name: Build Application
runs-on: ubuntu-latest
needs: [branch-validation, lint, test]
if: needs.branch-validation.outputs.valid == 'true'

strategy:
matrix:
go-version: ['1.25.4']
os: [ubuntu-latest]

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.head_ref }}

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

- name: Build application
run: |
# Создаем директорию для бинарников
mkdir -p dist

# Собираем основное приложение
echo "🔨 Building main application..."
go build -o dist/grpc-client -v -ldflags="-s -w" ./cmd/grpc-client
go build -o dist/grpc-server -v -ldflags="-s -w" ./cmd/grpc-server
go build -o dist/web-server -v -ldflags="-s -w" ./cmd/web-server

# Проверяем что все бинарники созданы
if [ -f dist/grpc-client ] && [ -f dist/grpc-server ] && [ -f dist/web-server ]; then
echo "✅ Build successful!"
ls -la dist/
else
echo "❌ Build failed!"
exit 1
fi

- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: application-binary
path: dist/
retention-days: 7
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write

env:
DOCKER_REGISTRY: rd2w

jobs:
release:
name: Build Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'

- name: Install syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
syft --version

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out

# Dependency directories
vendor/
node_modules/

# IDE
.vscode/
.idea/
*.swp
*.swo

# Environment files
.env
.env.local

# Logs
*.log

# Coverage
coverage.txt
coverage.html

# Build artifacts
bin/
dist/

# Local data for testing
data/

# OS specific
.DS_Store
Thumbs.db

# Temporary files
*.tmp
*.temp

# Local development configurations
local.config.*
*.local.yaml
*.local.yml

# Go workspace file
go.work
go.work.sum
Loading