-
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 #4 from snapp-incubator/init-cicd
Add GitHub Actions CI and Release Workflows
- Loading branch information
Showing
7 changed files
with
163 additions
and
29 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,31 +1,88 @@ | ||
--- | ||
name: ci | ||
on: | ||
- push | ||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
name: ci | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
jobs: | ||
lint: | ||
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 | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22' | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
go-version: 1.22 | ||
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out | ||
- uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
version: v1.58 | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.22 | ||
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out | ||
- uses: codecov/[email protected] | ||
with: | ||
files: coverage.out | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: snapp-incubator/nats-blackbox-exporter | ||
files: coverage.out | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: snapp-incubator/nats-blackbox-exporter | ||
build-push: | ||
name: Build & Push | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
- test | ||
strategy: | ||
matrix: | ||
command: [janus, ion-sfu] | ||
env: | ||
REGISTRY: ghcr.io | ||
USERNAME: ${{ github.repository_owner }} | ||
REPOSITORY: ${{ github.event.repository.name }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.22.x | ||
|
||
- name: Checks out our project source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ env.USERNAME }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: docker/metadata-action@v3 | ||
id: meta | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.REPOSITORY }}-${{ matrix.command }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
file: "build/Dockerfile" | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,28 @@ | ||
--- | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
jobs: | ||
goreleaser: | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v4 | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
version: '~> v1' | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -20,4 +20,5 @@ | |
# config | ||
config.yaml | ||
|
||
.DS_Store | ||
.DS_Store | ||
dist/ |
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,25 @@ | ||
--- | ||
project_name: nats-blackbox-exporter | ||
|
||
release: | ||
github: | ||
owner: snapp-incubator | ||
name: nats-blackbox-exporter | ||
|
||
checksum: {} | ||
|
||
builds: | ||
- binary: gosimac | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
main: ./cmd/nats-blackbox-exporter/main.go | ||
|
||
archives: | ||
- id: binary | ||
format: binary | ||
- id: default | ||
format: tar.gz |
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 |
---|---|---|
@@ -1 +1,24 @@ | ||
# nats-blackbox-exporter | ||
<h1 align="center"> NATS Blackbox Exporter </h1> | ||
|
||
<p align="center"> | ||
<img src="./.github/assets/image.png" height="250px"> | ||
</p> | ||
|
||
<p align="center"> | ||
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/snapp-incubator/nats-blackbox-exporter/ci.yaml?logo=github&style=for-the-badge"> | ||
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/snapp-incubator/nats-blackbox-exporter?logo=codecov&style=for-the-badge"> | ||
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/snapp-incubator/nats-blackbox-exporter?logo=github&style=for-the-badge"> | ||
<img alt="GitHub tag (with filter)" src="https://img.shields.io/github/v/tag/snapp-incubator/nats-blackbox-exporter?style=for-the-badge&logo=git"> | ||
<img alt="GitHub go.mod Go version (subdirectory of monorepo)" src="https://img.shields.io/github/go-mod/go-version/snapp-incubator/nats-blackbox-exporter?style=for-the-badge&logo=go"> | ||
</p> | ||
|
||
## Introduction | ||
|
||
Each probe publishes a message over Jetstream NATS and then waits to receive it through a subscription. By measuring the time taken for this process, you can monitor the status of your NATS cluster. At Snapp!, we use this to detect the status of our NATS clusters from the client perspective. | ||
|
||
You can track the following metrics: | ||
- **Connection**: A `prometheus.CounterVec` that counts disconnections and connections. | ||
- **Latency**: A `prometheus.Histogram` that measures the latency between publishing and subscribing. | ||
- **SuccessCounter**: A `prometheus.CounterVec` that counts successful publishes and consumes. | ||
|
||
This setup helps ensure that your NATS clusters are functioning optimally and provides insights into any issues from the client side. |
File renamed without changes.