Skip to content

Commit

Permalink
chore: v0.0.17 (#26)
Browse files Browse the repository at this point in the history
* ci: updated pipelines

* fix: added unique uuid to consumer and producers (#23)

* fix: added unique uuid to consumer and producers

* fix: updated dependencies and go version

* fix: added the ability to setup the consumer and producer names

* fix: fixed test to reduce the random name generated
  • Loading branch information
shoriwe authored Aug 26, 2023
1 parent d94fe4d commit 02a50a0
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 234 deletions.
77 changes: 0 additions & 77 deletions .github/workflows/build.yaml

This file was deleted.

22 changes: 7 additions & 15 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
name: Coverage

on:
workflow_run:
workflows:
- Build
types:
- completed

permissions: read-all
push:
branches: ["main"]

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.20"

go-version: "1.21"
- name: Set up docker environment
run: docker compose up -d

- name: Clean
run: go clean && go clean -cache
- name: Test
run: go test -coverpkg ./... -coverprofile coverage.txt -covermode atomic ./...

run: go test -p 1 -count 1 -coverpkg ./... -coverprofile coverage.txt -covermode count ./...
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
fail_ci_if_error: true

- name: Clean docker environment
run: docker compose down --rmi all -v --remove-orphans
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches: ["main"]

jobs:
versioning:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.latest_version.outputs.version }}
steps:
- uses: actions/checkout@v3
- id: latest_version
name: Latest version
run: python version.py >> $GITHUB_OUTPUT

create-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
needs:
- versioning
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.versioning.outputs.version }}
release_name: Release ${{ needs.versioning.outputs.version }}
draft: false
prerelease: false
28 changes: 28 additions & 0 deletions .github/workflows/tagging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tagging

on:
push:
branches: ["dev"]

jobs:
tagging:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"
- name: Git Identity
run: |
git checkout dev
git fetch --all --tags
git config --global user.email "[email protected]"
git config --global user.name "Antonio Donis"
- name: Changelog
run: 'npx standard-version --message "[ci skip] chore(release): %s"'
- name: Push changes
run: git push --follow-tags --force origin dev
36 changes: 36 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
pull_request:
branches: ["dev"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Clean
run: go clean && go clean -cache
- name: Build
run: go build .

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Set up docker environment
run: docker compose up -d
- name: Clean
run: go clean && go clean -cache
- name: Test
run: go test -p 1 -count 1 -v ./...
- name: Clean docker environment
run: docker compose down --rmi all -v --remove-orphans
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 0.0.17 (2023-08-26)


### Bug Fixes

* added unique uuid to consumer and producers ([#23](https://github.com/hidromatologia-v2/models/issues/23)) ([dad04ec](https://github.com/hidromatologia-v2/models/commit/dad04ec91492e5e95c1e5847f9333da9f058e511))

### 0.0.16 (2023-08-26)

### 0.0.15 (2023-08-04)


Expand Down
16 changes: 10 additions & 6 deletions common/connection/connection.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package connection

import (
"fmt"
"testing"

"github.com/hidromatologia-v2/models"
Expand All @@ -9,6 +10,7 @@ import (
"github.com/hidromatologia-v2/models/common/random"
"github.com/memphisdev/memphis.go"
redis_v9 "github.com/redis/go-redis/v9"
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
"github.com/wneessen/go-mail"
)
Expand Down Expand Up @@ -37,35 +39,37 @@ const (
)

func DefaultConsumer(t *testing.T) *memphis.Consumer {
return NewConsumer(t, testingStation)
return NewConsumer(t, testingStation, random.String()[:64])
}

func DefaultProducer(t *testing.T) *memphis.Producer {
return NewProducer(t, testingStation)
return NewProducer(t, testingStation, random.String()[:64])
}

func NewConsumer(t *testing.T, station string) *memphis.Consumer {
func NewConsumer(t *testing.T, station, name string) *memphis.Consumer {
conn, cErr := memphis.Connect(
"127.0.0.1",
"root",
memphis.Password("memphis"),
// memphis.ConnectionToken("memphis"),
)
assert.Nil(t, cErr)
c, err := conn.CreateConsumer(station, random.String())
name = fmt.Sprintf("%s-%s", name, uuid.NewV4().String())
c, err := conn.CreateConsumer(station, name)
assert.Nil(t, err)
return c
}

func NewProducer(t *testing.T, station string) *memphis.Producer {
func NewProducer(t *testing.T, station, name string) *memphis.Producer {
conn, cErr := memphis.Connect(
"127.0.0.1",
"root",
memphis.Password("memphis"),
// memphis.ConnectionToken("memphis"),
)
assert.Nil(t, cErr)
prod, err := conn.CreateProducer(station, random.String())
name = fmt.Sprintf("%s-%s", name, uuid.NewV4().String())
prod, err := conn.CreateProducer(station, name)
assert.Nil(t, err)
return prod
}
4 changes: 2 additions & 2 deletions common/connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func TestDefaultProducer(t *testing.T) {
}

func TestNewConsumer(t *testing.T) {
c := NewConsumer(t, random.String())
c := NewConsumer(t, random.String(), random.String()[:64])
assert.NotNil(t, c)
defer c.Destroy()
}

func TestNewProducer(t *testing.T) {
c := NewProducer(t, random.String())
c := NewProducer(t, random.String(), random.String()[:64])
assert.NotNil(t, c)
defer c.Destroy()
}
Loading

0 comments on commit 02a50a0

Please sign in to comment.