Skip to content

Commit

Permalink
Merge pull request #62 from go-park-mail-ru/dev
Browse files Browse the repository at this point in the history
Релиз РК 4
  • Loading branch information
bqback authored Dec 18, 2024
2 parents 17f7af1 + 39e154d commit 1bc8405
Show file tree
Hide file tree
Showing 131 changed files with 23,432 additions and 1,409 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CD workflow
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Executing remote ssh connection
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER_NAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo rm -rf ~/CD
mkdir ~/CD
cd ~/CD
git clone https://github.com/go-park-mail-ru/2024_2_VKatuny.git .
cp ~/configs/conf.yml ./configs/
cp ~/configs/tern.conf ./db/migrations/
cp ~/configs/prometheus.yml ./configs/
cp ~/configs/.env ./
sudo docker compose -f ./all-services-compose.yaml down
sudo docker compose -f ./all-services-compose.yaml build
sudo docker compose -f ./all-services-compose.yaml up -d
cd ./db/migrations/
~/go/bin/tern migrate
156 changes: 156 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: CI workflow
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.23.x"
- name: Install Linter
run: go install github.com/mgechev/revive@latest
- name: Lint files
run: make lint
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.23.x"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libvips-dev
sudo apt-get install -y wkhtmltopdf
- name: Run tests
run: |
go test -v ./... -coverprofile=coverage.out.tmp
cat coverage.out.tmp | grep -v -E 'docs|mock|pb.go|_easyjson.go' > coverage.out
go tool cover -func=coverage.out -o coverage.out
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage.out

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}

build-main-service:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build main-service
run: docker build . -f ./build/services/app/Dockerfile

build-auth-service:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build auth-service
run: docker build . -f ./build/services/auth/Dockerfile

build-compress-service:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build compress-service
run: docker build . -f ./build/services/compress_microservice/Dockerfile

build-notifications-service:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build notifications-service
run: docker build . -f ./build/services/notifications/Dockerfile

build-db:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build db
run: docker build . -f ./build/db/Dockerfile

generate-api:
runs-on: ubuntu-latest
needs:
[
build-main-service,
build-auth-service,
build-compress-service,
build-notifications-service,
build-db,
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.23.x"
- name: Install dependencies
run: |
go install github.com/swaggo/swag/cmd/swag@latest
go get ./...
- name: Generate API specification
run: |
swag init -g main.go -d ./cmd/app/ -o ./api --pd
- name: Check if API updated
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
api
- name: Commit API
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add ./api
git commit -m "chore: update api"
- name: Push API
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ configs/redis.conf


# html
*.html
index.html

*.pdf
*.crt
*.key
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BUILD_FLAGS=

# domain dirs in internal/pkg
DOMAINS=applicant cvs employer portfolio session vacancies file_loading

MICROSERVICE_DOMAINS = notifications



Expand All @@ -25,7 +25,7 @@ install:

tests:
go test ./... -coverprofile=coverage.out.tmp
cat coverage.out.tmp | grep -v -E 'mock|pb.go' > coverage.out
cat coverage.out.tmp | grep -v -E 'docs|mock|pb.go|_easyjson.go' > coverage.out
go tool cover -func=coverage.out
go tool cover -html=coverage.out -o index.html

Expand All @@ -36,7 +36,7 @@ lint:
revive -config reviveconfig.toml -formatter friendly ./...

api:
swag init --parseInternal --pd --dir cmd/myapp/,delivery/handler/ --output api/
swag init --generalInfo ./cmd/app/main.go --output api/ --pd
node ./api/server.js

mock-gen:
Expand All @@ -48,6 +48,20 @@ mock-gen:
-destination=internal/pkg/$$domain/mock/$$domain.go \
-package=mock; \
done
@for domain in $(MICROSERVICE_DOMAINS); do \
echo "Generating mocks for domain: $$domain"; \
rm -rf microservice/$$domain/mock; \
mockgen -source=microservices/$$domain/$$domain/$$domain.go \
-destination=microservices/$$domain/$$domain/mock/$$domain.go \
-package=mock; \
done
@echo "Generating mocks for auth microservice"
@rm -rf microservices/auth/mock
@mockgen -source=microservices/auth/gen/auth_grpc.pb.go -destination=microservices/auth/mock/mock_grpc.go -package=mock
@mockgen -source=microservices/auth/auth.go -destination=microservices/auth/mock/mock_delivery.go -package=mock
@echo "Generating gRPC mocks for notifications microservice"
@rm -rf microservices/notifications/mock
@mockgen -source=microservices/notifications/generated/notifications_grpc.pb.go -destination=microservices/notifications/mock/mock_grpc.go -package=mock
@echo "OK!"

redis-start:
Expand All @@ -57,4 +71,8 @@ auth-microservice:
go run ./cmd/auth/main.go

run:
go run $(SRC_DIR)/main.go
go run $(SRC_DIR)/main.go

easyjson-gen:
easyjson -all ./internal/pkg/dto
easyjson -all ./microservices/notifications/notifications/dto
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 2024_2_VKatuny
![Coverage](https://img.shields.io/badge/Coverage-60.8%25-yellow)

Данный репозиторий предназначен для хранения frontend части проекта HeadHunter,
разрабатываемого командой VKатуны.
Expand Down Expand Up @@ -51,3 +52,18 @@ make lint
```bash
make tests
```

### Необходимые библиотеки
go-pdfium
https://github.com/klippa-app/go-pdfium?tab=readme-ov-file
pdfium
https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F6886/pdfium-linux-x64.tgz

govips
https://github.com/davidbyttow/govips
+
https://github.com/davidbyttow/govips/issues/100
(
sudo apt install pkg-config
sudo apt install libvips-dev
)
Loading

0 comments on commit 1bc8405

Please sign in to comment.