-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from go-park-mail-ru/dev
Релиз РК 4
- Loading branch information
Showing
131 changed files
with
23,432 additions
and
1,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,8 @@ configs/redis.conf | |
|
||
|
||
# html | ||
*.html | ||
index.html | ||
|
||
*.crt | ||
*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.