Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
maeb committed Nov 3, 2023
0 parents commit c1591ae
Show file tree
Hide file tree
Showing 28 changed files with 1,745 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.warc.gz filter=lfs diff=lfs merge=lfs -text
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug Report
about: Create a bug report to help us improve
labels: "bug"
---

**Bug Report**

<!--
A clear and concise description of what the bug is.
-->

**To Reproduce**

```shell
# A standalone program is preferred
```

**Expected Behavior**

<!--
What was the expected behavior of the program? Was it supposed to exit without errors or
do something else?
-->

**Actual Behavior**

<!--
What actually happened? Please add any relevant output in this section
-->

**Your Environment**

<!-- This could include, operating system, version of the software, etc-->
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Propose a new feature
labels: "feature"
---

**Motivation**

<!--
Please explain the rationale for adding the feature. Do you have a scenario that illustrates your needs?
-->

**Feature**

<!--
A short description of the feature.
-->
31 changes: 31 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
commit-message:
prefix: "build"
include: "scope"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
commit-message:
prefix: "build"
include: "scope"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
commit-message:
prefix: "build"
include: "scope"
51 changes: 51 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Main
on: push

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: Build
run: "go build ./..."
- name: Test
run: "go test ./..."
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.1
args: --config=.golangci.yaml
codeqL-build:
name: CodeQL build
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+**"

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

jobs:
build:
name: Create and release docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels, version) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/fai
118 changes: 118 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
output:
format: github-actions
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
sort-results: true

linters-settings:
gofmt:
simplify: true

issues:
max-issues-per-linter: 0
max-same-issues: 0

severity:
case-sensitive: true

linters:
enable-all: true
disable:
# TODO(https://github.com/nlnwa/go_container/issues/3): The following
# sub-linters should be evaluated if they are going to be enabled or not.
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- cyclop
- deadcode
- decorder
- depguard
- dogsled
- dupl
- dupword
- errchkjson
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofumpt
- goheader
- goimports
- golint
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- grouper
- ifshort
- importas
- interfacebloat
- interfacer
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- maligned
- mirror
- misspell
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosnakecase
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- scopelint
- sqlclosecheck
- structcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
- varcheck
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.21 AS build

WORKDIR /go/src/app

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" .


FROM gcr.io/distroless/static-debian12:latest

COPY --from=build /go/src/app/fai /fai

EXPOSE 8081

ENTRYPOINT ["/fai"]
Loading

0 comments on commit c1591ae

Please sign in to comment.