Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 3e0271d

Browse files
Initial version
0 parents  commit 3e0271d

26 files changed

Lines changed: 3572 additions & 0 deletions

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.*
2+
*.md
3+
Dockerfile
4+
Dockerfile-*
5+
docker-compose.yaml
6+
vendor

.github/.goreleaser.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
env:
2+
- GO111MODULE=on
3+
- CGO_ENABLED=0
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
9+
builds:
10+
- main: ./cmd/gofer
11+
id: "gofer"
12+
binary: gofer
13+
goos:
14+
- linux
15+
- darwin
16+
archives:
17+
-
18+
id: "gofer"
19+
builds:
20+
- gofer
21+
name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Release Gofer CLI Docker Image"
2+
on:
3+
workflow_dispatch: # Allow manual trigger
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
- v[0-9]+.[0-9]+.[0-9]+-[0-9]+
8+
- v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Docker metadata
18+
uses: docker/metadata-action@v3
19+
id: meta
20+
with:
21+
images: ghcr.io/chronicleprotocol/gofer-cli
22+
tags: |
23+
type=semver,pattern={{version}}
24+
type=semver,pattern={{major}}.{{minor}}
25+
type=semver,pattern={{major}}
26+
type=sha
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@master
30+
with:
31+
platforms: all
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
35+
id: buildx
36+
with:
37+
install: true
38+
39+
- name: Login to Github Packages
40+
uses: docker/login-action@v2
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Build and push
47+
uses: docker/build-push-action@v4
48+
with:
49+
context: .
50+
file: ./Dockerfile-gofer
51+
platforms: linux/amd64,linux/arm64
52+
push: ${{ github.event_name != 'pull_request' }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release Binaries
2+
on:
3+
workflow_dispatch: # Allow manual trigger
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
8+
9+
jobs:
10+
goreleaser:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: '1.20'
22+
- run: go version
23+
24+
- name: Run GoReleaser
25+
# if: startsWith(github.ref, 'refs/tags/')
26+
uses: goreleaser/goreleaser-action@v4
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean -f .github/.goreleaser.yml
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Run Tests
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
pull_request:
8+
branches:
9+
- master
10+
- main
11+
12+
jobs:
13+
test:
14+
name: Code Linting & Unit Tests
15+
strategy:
16+
matrix:
17+
go-version: [ 1.20.x ]
18+
os: [ ubuntu-latest ]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- name: Install Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
- name: Checkout Code
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: '0'
29+
- name: Linting Code
30+
uses: golangci/golangci-lint-action@v3
31+
with:
32+
version: v1.53
33+
args: --timeout=10m0s
34+
- name: Start Redis Instance
35+
run: docker run -d -p 6379:6379 --name redis -e REDIS_PASSWORD=password123 bitnami/redis:6.2
36+
- name: Run Go Tests (TEXT)
37+
run: go test -v $(go list ./... | grep -v /e2e/)
38+
env:
39+
TEST_REDIS_ADDR: "127.0.0.1:6379"
40+
TEST_REDIS_PASS: "password123"
41+
TEST_REDIS_DB: 0
42+
analyze:
43+
needs: test
44+
name: Analyze with CodeQL
45+
runs-on: ubuntu-latest
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
language: [ 'go' ]
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v2
53+
with:
54+
fetch-depth: 0
55+
- name: Initialize CodeQL
56+
uses: github/codeql-action/init@v2
57+
with:
58+
languages: ${{ matrix.language }}
59+
- name: Autobuild
60+
uses: github/codeql-action/autobuild@v2
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v2

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Some popular IDEs
2+
.vscode
3+
.idea
4+
5+
# Binaries for programs and plugins
6+
*.exe
7+
*.exe~
8+
*.dll
9+
*.so
10+
*.dylib
11+
12+
# Dependency directories
13+
vendor/
14+
15+
# Compiled binaries
16+
/bin/*
17+
/dist/
18+
19+
# Test binary, built with `go test -c`
20+
*.test
21+
22+
# Output of the go coverage tool
23+
*.out
24+
25+
# Temporary and local files
26+
.tmp
27+
.DS_Store
28+
node_modules/
29+
/package*.json
30+
31+
# Go Workspaces
32+
go.work

0 commit comments

Comments
 (0)