Skip to content

Commit

Permalink
first version of gosmee
Browse files Browse the repository at this point in the history
Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Apr 20, 2022
0 parents commit d485d9e
Show file tree
Hide file tree
Showing 620 changed files with 250,953 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create and publish a Docker image to ghcr

on: ["push"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
53 changes: 53 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Test
on: ["push", "pull_request"]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.18

- name: Check out code
uses: actions/checkout@v1

- name: Lint Go Code
run: |
export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
make lint-go
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.18

- name: Check out code
uses: actions/checkout@v1

- name: Build
run: |
make build
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.18

- name: Check out code
uses: actions/checkout@v1

- name: Run Unit tests.
run: |
make test
36 changes: 36 additions & 0 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- '*'

permissions:
contents: write
# packages: write
issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/*
.envrc
60 changes: 60 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
run:
build-tags:
- e2e
skip-dirs:
- vendor
linters-settings:
gocritic:
disabled-checks:
- unlambda
linters:
enable:
- asciicheck
- bodyclose
- depguard
- dogsled
- durationcheck
- exhaustive
# - exhaustivestruct
- exportloopref
- forbidigo
- forcetypeassert
- gochecknoinits
- dupl
- errcheck
- errorlint
- gofumpt
- goimports
- gosec
- gocritic
- misspell
- deadcode
- gosec
- govet
- ifshort
- importas
- makezero
- nakedret
- predeclared
- revive
- stylecheck
- unparam
- gochecknoinits
# - goconst
# - gocyclo
# - goerr113
- gofmt
- goheader
- gomodguard
- goprintffuncname
- nilerr
- noctx
- nolintlint
- prealloc
- promlinter
- rowserrcheck
- sqlclosecheck
- tparallel
#- unconvert
- wastedassign
- whitespace
68 changes: 68 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
builds:
- env:
- CGO_ENABLED=0
main: ./
binary: gosmee
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -w
- -s
archives:
- name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
darwin: MacOS
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"

snapshot:
name_template: "{{ .Tag }}-next"

release:
prerelease: true

nfpms:
- file_name_template: "gosmee-{{.Version}}_{{.Os}}-{{.Arch}}"
homepage: https://github.com/chmouel/gosmee
description: Gosmee - smee.io forwarder in go
maintainer: Chmouel Boudjnah <[email protected]>
license: Apache 2.0
formats:
- deb
- rpm
bindir: /usr/bin
replacements:
amd64: 64bit
386: 32bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows

changelog:
sort: asc
use: github
filters:
exclude:
- "^docs:"
- "^test:"
- Merge pull request
- Merge branch
- go mod tidy

universal_binaries:
- replace: true
name_template: "gosmee"
7 changes: 7 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"line-length": false,
"first-header-h1": false,
"no-inline-html": false,
"MD013": false,
"MD025": false
}
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: ["pre-push"]
exclude: '(^docs/themes/hugo-book|^vendor|.*golden$|^\.vale)'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
- id: check-shebang-scripts-are-executable
- id: check-json
- id: check-vcs-permalinks
- repo: local
hooks:
- id: lint-markdown
name: "Lint Markdown"
entry: make
args: ["lint-md"]
language: system
types: [markdown]
pass_filenames: false
- id: lint-go
name: "Lint GO"
entry: make
args: ["lint-go"]
language: system
types: [go]
pass_filenames: false
- id: test
name: "Unit testing"
entry: make
args: ["test"]
language: system
types: [go]
pass_filenames: false
72 changes: 72 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Vale configuration file for the https://github.com/redhat-documentation/vale-at-red-hat repository.
# See: https://docs.errata.ai/vale/config

# Core settings appear at the top (the "global" section).

# The relative path to the folder containing linting rules (styles).
StylesPath = .vale/styles

# Vocab define the exceptions to use in *all* `BasedOnStyles`.
# See: https://docs.errata.ai/vale/vocab
; Vocab = RedHat

# Minimum alert level
# -------------------
# The minimum alert level in the output (suggestion, warning, or error).
# If integrated into CI, builds fail by default on error-level alerts, unless you run Vale with the --no-exit flag
MinAlertLevel = error

# IgnoredScopes specifies inline-level HTML tags to ignore.
# These tags may occur in an active scope (unlike SkippedScopes, skipped entirely) but their content still will not raise any alerts.
# Default: ignore `code` and `tt`.
IgnoredScopes = code, tt, img, url, a, body.id
# SkippedScopes specifies block-level HTML tags to ignore. Ignore any content in these scopes.
# Default: ignore `script`, `style`, `pre`, and `figure`.
# For AsciiDoc: by default, listingblock, and literalblock.
SkippedScopes = script, style, pre, figure, code, tt, blockquote, listingblock, literalblock

[formats]
# Associate `*.properties` files with the `md` format
properties = md

# Match AsciiDoc files. See: https://docs.errata.ai/vale/scoping
# Ignore files in a directory starting by `.`
# to avoid raising errors for `.vale/fixtures/*/testinvalid.adoc` files
[[!.]*.adoc]
# Styles to load, located in the `StylesPath` folder:
BasedOnStyles = RedHat
; Ignore attributes definition, id statements
TokenIgnores = (:[^\n]+: [^\n]+), (\[id=[^\n]+)

; RedHat.BareMetal = NO


# Match Markdown files. See: https://docs.errata.ai/vale/scoping
# Match also `*.properties` files (see the `format` section).
[*.md]
# Styles to load, located in the `StylesPath` folder:
BasedOnStyles = RedHat

# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs.
TokenIgnores = (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[)

# Match Restructured text files
[*.rst]
# Styles to load, located in the `StylesPath` folder:
BasedOnStyles = RedHat

# Match INI files. See: https://docs.errata.ai/vale/scoping
[*.ini]
# Styles to load, located in the `StylesPath` folder:
BasedOnStyles = RedHat
# Ignore code surrounded by backticks or plus sign, parameters defaults, URLs.
TokenIgnores = (\x60[^\n\x60]+\x60), ([^\n]+=[^\n]*), (\+[^\n]+\+), (http[^\n]+\[)
# Disabling rules (NO)
RedHat.CaseSensitiveTerms = NO
RedHat.ConfigMap = NO
RedHat.Definitions = NO
RedHat.Slash = NO
RedHat.Spacing = NO
RedHat.Spelling = NO
RedHat.TermsSuggestions = NO

5 changes: 5 additions & 0 deletions .vale/fixtures/RedHat/Abbreviations/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `Abbreviations` rule
StylesPath = ../../../styles
MinAlertLevel = suggestion
[*.adoc]
RedHat.Abbreviations = YES
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions .vale/fixtures/RedHat/CaseSensitiveTerms/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Vale configuration file to test the `CaseSensitiveTerms` rule
StylesPath = ../../../styles
MinAlertLevel = suggestion
[*.adoc]
RedHat.CaseSensitiveTerms = YES
Loading

0 comments on commit d485d9e

Please sign in to comment.