-
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 #59 from go-park-mail-ru/dev
Dev
- Loading branch information
Showing
84 changed files
with
15,882 additions
and
2,304 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,102 @@ | ||
name: Build, Test, and Push Services | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.1' | ||
- name: Install golangci-lint | ||
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
- name: Run golangci-lint | ||
run: golangci-lint run ./... | ||
|
||
build-test-and-push: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
steps: | ||
# 1. Checkout repository | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# 2. Set up Go | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.1' | ||
|
||
# 3. Install dependencies | ||
- name: Install Go dependencies | ||
run: | | ||
go mod tidy | ||
go get ./... | ||
go mod vendor | ||
# 4. Run tests | ||
- name: Run Go tests | ||
run: | | ||
go test -coverpkg=./... -coverprofile=cover ./... && cat cover | grep -v "mock" | grep -v "easyjson" | grep -v "proto" | grep -v "pb" | grep -v "grpc" > cover.out && go tool cover -func=cover.out | ||
# 5. Login to DockerHub | ||
- name: Login to DockerHub Registry | ||
run: echo ${{secrets.DOCKERHUB_TOKEN}} | docker login -u ${{secrets.DOCKERHUB_USERNAME}} --password-stdin | ||
|
||
# 6. Build ads_service | ||
- name: Build and push ads_service | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./microservices/ads_service/Dockerfile | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/ads_service:latest | ||
push: true | ||
|
||
# 7. Build auth_service | ||
- name: Build and push auth_service | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./microservices/auth_service/Dockerfile | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/auth_service:latest | ||
push: true | ||
|
||
# 8. Build city_service | ||
- name: Build and push city_service | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./microservices/city_service/Dockerfile | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/city_service:latest | ||
push: true | ||
|
||
# 9. Build migrator | ||
- name: Build and push migrator | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./cmd/migrator/Dockerfile | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/migrator:latest | ||
push: true | ||
|
||
# 10. Build backend (main service) | ||
- name: Build and push backend | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
tags: ${{secrets.DOCKERHUB_USERNAME}}/backend:latest | ||
push: true | ||
|
Oops, something went wrong.