Global refactoring #25
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
version: v1.54.2 | |
test: | |
needs: lint | |
runs-on: ubuntu-latest | |
env: | |
TZ: Europe/Moscow | |
DB_USER: chatyx_user | |
DB_PASSWORD: chatyx_password | |
DB_NAME: chatyx_db_test | |
services: | |
postgres: | |
image: postgres:15.4 | |
env: | |
POSTGRES_USER: ${{ env.DB_USER }} | |
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} | |
POSTGRES_DB: ${{ env.DB_NAME }} | |
options: >- | |
--health-cmd "pg_isready" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 15432:5432 | |
redis: | |
image: redis:7.2 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 16379:6379 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Run unit tests | |
run: go test -v -coverprofile=cover.out ./internal/... ./pkg/... && go tool cover -func=cover.out | |
- name: Run integration tests | |
run: go test -v ./test/... -run TestAppTestSuite | |
publish: | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build docker image and push into registry | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
tags: | | |
mortalis/chatyx-backend:0.1.0 | |
mortalis/chatyx-backend:latest |