Skip to content

Commit

Permalink
General: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrMitin committed May 28, 2024
1 parent f5c8c69 commit 9693994
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 28 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/deploy.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/commit.yml → .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Go

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test, lint and deploy

on:
push:
branches: [ main, dev ]

jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: ^1.22

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: go get ./...

- name: Run make test
run: make test

golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58

deploy:
name: Deploy to VM
runs-on: ubuntu-latest

steps:
- name: Execute commands over ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd ./back
sudo git checkout dev
sudo git pull
sudo make docker-build
sudo docker-compose down
sudo docker-compose up -d
4 changes: 4 additions & 0 deletions internal/rest/chat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ func (c *ChatServer) listenWrite(ctx context.Context, client *chat.Client) {
for {
select {
case message, ok := <-client.Send:
if !ok {
return
}

messages := make([][]byte, 0, len(client.Send)+1)

messageData, err := easyjson.Marshal(message)
Expand Down

0 comments on commit 9693994

Please sign in to comment.