Skip to content

Commit

Permalink
chore: v0.0.7 (#7)
Browse files Browse the repository at this point in the history
* ci: update ci (#6)

* fix: update ci pipelines

* fix: single docker compose

* fix: updated dockerfile go version

* fix: append unique uuid to producer and consumer names

* fix: updated dependencies

* fix: updated models new producer call
  • Loading branch information
shoriwe authored Aug 26, 2023
1 parent 497338c commit 08660c5
Show file tree
Hide file tree
Showing 15 changed files with 287 additions and 432 deletions.
128 changes: 0 additions & 128 deletions .github/workflows/build.yaml

This file was deleted.

24 changes: 8 additions & 16 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 count ./...

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
run: docker compose down --rmi all -v --remove-orphans
110 changes: 110 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
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

build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- versioning
- create-release
steps:
- uses: actions/checkout@v3

- name: Docker image
run: echo "v${{ needs.versioning.outputs.version }}"

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}

build-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
needs:
- create-release
strategy:
matrix:
os: [linux]
arch: [amd64, "386"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Prepare bin directory
run: mkdir -p bin
- name: Generate asset name
id: gen-asset-name
run: echo filename=${{ github.event.repository.name }}.${{ matrix.os }}.${{ matrix.arch }}$(python -c "import os; print('.exe' if os.getenv('GOOS') == 'windows' else '', end='')") >> $GITHUB_OUTPUT
- name: Build binary
run: go build -v -o bin/${{ steps.gen-asset-name.outputs.filename }}
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- name: UPX
run: upx bin/*
- name: Upload Binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./bin/${{ steps.gen-asset-name.outputs.filename }}
asset_name: ${{ steps.gen-asset-name.outputs.filename }}
asset_content_type: application/octet-stream
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 "antoniojosedonishung@gmail.com"
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.7 (2023-08-26)

### 0.0.6 (2023-08-04)


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS build-stage
FROM golang:1.21-alpine AS build-stage

RUN apk add upx
WORKDIR /alerts-src
Expand Down
Loading

0 comments on commit 08660c5

Please sign in to comment.