Skip to content

Commit b2f5184

Browse files
committed
Initial sync
0 parents  commit b2f5184

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+11441
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
reviewers:
8+
- "surki"
9+
- "samof76"
10+
- "raghu-nandan-bs"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/[email protected]
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
compat-lookup: true
19+
- name: Enable auto-merge for Dependabot PRs
20+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.compatibility-score >= 75}}
21+
run: |
22+
gh pr review "$PR_URL" --approve
23+
gh pr merge "$PR_URL" --auto --squash
24+
env:
25+
PR_URL: ${{github.event.pull_request.html_url}}
26+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Create a release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Unshallow
15+
run: git fetch --prune --unshallow
16+
- name: Setup golang
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: '1.20.x'
20+
- name: Docker Login
21+
uses: docker/login-action@v1
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
- name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v1
28+
with:
29+
version: latest
30+
args: release --rm-dist
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/testing.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Integration Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
branches:
8+
- master
9+
10+
jobs:
11+
run_test:
12+
name: Run integration tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: '0'
19+
ref: ${{ github.event.pull_request.head.sha }}
20+
- name: Restore Go cache
21+
uses: actions/cache@v1
22+
id: cache
23+
with:
24+
path: ~/go/pkg/mod
25+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
26+
restore-keys: |
27+
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
${{ runner.os }}-go-
29+
- name: Setup Golang
30+
uses: actions/setup-go@v2
31+
with:
32+
go-version: '1.20.x'
33+
- name: Run make test
34+
run: |
35+
make test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
lg
2+
dist/
3+
tmp/
4+
.vscode
5+
.idea

.goreleaser.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
binary: lg
9+
ldflags:
10+
- -X {{.ModulePath}}/cmd.Version={{.Version}}
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
goarch:
16+
- amd64
17+
- arm64
18+
archives:
19+
- wrap_in_directory: true
20+
format: zip
21+
files:
22+
- scripts/*
23+
24+
dockers:
25+
- goos: linux
26+
goarch: amd64
27+
# use: buildx
28+
image_templates:
29+
- "ghcr.io/freshworks/load-generator/load-generator:{{ .Version }}-amd64"
30+
build_flag_templates:
31+
- "--platform=linux/amd64"
32+
- "--label=org.opencontainers.image.created={{.Date}}"
33+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
34+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
35+
- "--label=org.opencontainers.image.version={{.Version}}"
36+
extra_files:
37+
- scripts
38+
# - use: buildx
39+
# goos: linux
40+
# goarch: arm64
41+
# image_templates:
42+
# - "ghcr.io/freshworks/load-generator/load-generator:{{ .Version }}-arm64"
43+
# build_flag_templates:
44+
# - "--platform=linux/arm64"
45+
# - "--label=org.opencontainers.image.created={{.Date}}"
46+
# - "--label=org.opencontainers.image.title={{.ProjectName}}"
47+
# - "--label=org.opencontainers.image.revision={{.FullCommit}}"
48+
# - "--label=org.opencontainers.image.version={{.Version}}"
49+
# extra_files:
50+
# - scripts
51+
52+
checksum:
53+
name_template: 'checksums.txt'
54+
snapshot:
55+
name_template: "{{ .Tag }}-next"
56+
changelog:
57+
use: github
58+
sort: asc
59+
filters:
60+
exclude:
61+
- '^docs:'
62+
- '^test:'

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM debian:bookworm-slim
2+
3+
RUN \
4+
apt-get update \
5+
&& apt-get install -y --no-install-recommends \
6+
ca-certificates \
7+
curl \
8+
procps \
9+
dnsutils \
10+
netcat-openbsd \
11+
net-tools \
12+
git \
13+
vim \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
USER nobody:nobody
17+
COPY lg /opt/
18+
COPY scripts/ /opt/scripts/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Freshworks Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
SHELL := /bin/bash
2+
BINARY = lg
3+
BUILDFLAGS = $(LDFLAGS) $(EXTRAFLAGS)
4+
5+
.PHONY: $(BINARY)
6+
$(BINARY): Makefile
7+
CGO_ENABLED=0 go build -o $(BINARY) $(BUILDFLAGS)
8+
9+
test:
10+
go test -count=1 -race ./...
11+
12+
.PHONY: clean
13+
clean:
14+
rm -f $(BINARY) $(TARGETS)
15+
rm -rf ./dist
16+
17+
.PHONY: snapshot
18+
snapshot: clean
19+
goreleaser --snapshot --skip-validate --skip-publish
20+
21+
.PHONY: release
22+
release: clean
23+
goreleaser --skip-validate --skip-publish
24+
25+
.PHONY: publish
26+
publish: clean
27+
goreleaser

0 commit comments

Comments
 (0)