Skip to content

Commit 5469fd6

Browse files
committed
first commit
0 parents  commit 5469fd6

Some content is hidden

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

51 files changed

+21031
-0
lines changed

.github/renovate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base"],
4+
"labels": ["dependencies"],
5+
"postUpdateOptions": ["gomodTidy"]
6+
}

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: build
3+
4+
on:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 3
17+
- name: Determine Go version from go.mod
18+
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: ${{ env.GO_VERSION }}
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v2
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
- name: Cache Go modules
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/go/pkg/mod
31+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
32+
restore-keys: |
33+
${{ runner.os }}-go-
34+
- name: Log in to GitHub Container registry
35+
uses: docker/login-action@v2
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Run GoReleaser
41+
uses: goreleaser/goreleaser-action@v4
42+
if: success() && startsWith(github.ref, 'refs/tags/')
43+
with:
44+
version: latest
45+
args: release --rm-dist
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [master]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [master]
20+
schedule:
21+
- cron: "22 20 * * 5"
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: ["go"]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33+
# Learn more:
34+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v2
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
49+
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, then you should remove it and run the build manually (see below)
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v2
54+
55+
# ℹ️ Command-line programs to run using the OS shell.
56+
# 📚 https://git.io/JvXDl
57+
58+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59+
# and modify them (or add more) to build your code if your project
60+
# uses a compiled language
61+
62+
#- run: |
63+
# make bootstrap
64+
# make release
65+
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: golangci-lint
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
pull_request:
10+
permissions:
11+
contents: read
12+
jobs:
13+
golangci:
14+
name: lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Determine Go version from go.mod
19+
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: ${{ env.GO_VERSION }}
24+
- name: golangci-lint
25+
uses: golangci/golangci-lint-action@v3
26+
with:
27+
args: --issues-exit-code=0 --timeout=3m ./...

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vimbin
2+
.vimbin
3+
*.txt

.gorelease.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
project_name: vimbin
3+
before:
4+
hooks:
5+
- go mod tidy
6+
builds:
7+
- main: ./main.go
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
goarch:
14+
- amd64
15+
- arm64
16+
- arm
17+
dockers:
18+
- image_templates:
19+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-amd64
20+
use: buildx
21+
dockerfile: Dockerfile
22+
extra_files:
23+
- go.mod
24+
- go.sum
25+
- main.go
26+
- cmd
27+
- internal
28+
- web
29+
build_flag_templates:
30+
- --pull
31+
- --platform=linux/amd64
32+
- --label=org.opencontainers.image.title={{ .ProjectName }}
33+
- --label=org.opencontainers.image.description={{ .ProjectName }}
34+
- --label=org.opencontainers.image.url=https://github.com/containeroo/vimbin
35+
- --label=org.opencontainers.image.source=https://github.com/containeroo/vimbin
36+
- --label=org.opencontainers.image.version={{ .Version }}
37+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
38+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
39+
- --label=org.opencontainers.image.licenses="GNU General Public License v3.0"
40+
- image_templates:
41+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-arm64
42+
use: buildx
43+
dockerfile: Dockerfile
44+
extra_files:
45+
- go.mod
46+
- go.sum
47+
- main.go
48+
- cmd
49+
- internal
50+
- web
51+
goarch: arm64
52+
build_flag_templates:
53+
- --pull
54+
- --platform=linux/arm64
55+
- --label=org.opencontainers.image.title={{ .ProjectName }}
56+
- --label=org.opencontainers.image.description={{ .ProjectName }}
57+
- --label=org.opencontainers.image.url=https://github.com/containeroo/vimbin
58+
- --label=org.opencontainers.image.source=https://github.com/containeroo/vimbin
59+
- --label=org.opencontainers.image.version={{ .Version }}
60+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
61+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
62+
- --label=org.opencontainers.image.licenses="GNU General Public License v3.0"
63+
docker_manifests:
64+
- name_template: ghcr.io/containeroo/vimbin:{{ .Tag }}
65+
image_templates:
66+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-amd64
67+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-arm64
68+
- name_template: ghcr.io/containeroo/vimbin:latest
69+
image_templates:
70+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-amd64
71+
- ghcr.io/containeroo/vimbin:{{ .Tag }}-arm64

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM golang:1.20-alpine as builder
2+
3+
WORKDIR /workspace
4+
# Copy the Go Modules manifests
5+
COPY go.mod go.sum ./
6+
# cache deps before building and copying source so that we don't need to re-download as much
7+
# and so that source changes don't invalidate our downloaded layer
8+
RUN go mod download
9+
10+
# Copy the go source
11+
COPY . .
12+
13+
# Build
14+
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -installsuffix nocgo -o /vimbin
15+
16+
FROM gcr.io/distroless/static:nonroot
17+
18+
WORKDIR /
19+
20+
COPY --from=builder /vimbin ./
21+
USER 65532:65532
22+
23+
ENTRYPOINT ["./vimbin"]

0 commit comments

Comments
 (0)