Skip to content

Commit

Permalink
chore: 🚀 init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Mar 8, 2024
1 parent 0fe21cc commit 35df9c0
Show file tree
Hide file tree
Showing 23 changed files with 3,976 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ubuntu/.devcontainer/base.Dockerfile

# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install protobuf-compiler
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "zeiss/template-go",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
"args": {
"VARIANT": "ubuntu-22.04"
}
},
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"postCreateCommand": "bash scripts/postCreateCommand.sh",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/go:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"GitHub.vscode-github-actions",
"golang.go",
"ms-vscode.makefile-tools"
]
}
}
}
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
SCRIPT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "${BASH_SOURCE:-$0}"`

export PROJECT_DIR=$(dirname $SCRIPT)
export GO111MODULE=on
export DOCKER_HOST_IP=127.0.0.1
export GOPROXY=direct
export PATH=$PATH:$PWD/bin
8 changes: 8 additions & 0 deletions .envsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
SCRIPT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "${BASH_SOURCE:-$0}"`

export PROJECT_DIR=$(dirname $SCRIPT)
export GO111MODULE=on
export DOCKER_HOST_IP=127.0.0.1
export GOPROXY=direct
export PATH=$PATH:$PWD/bin
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Automatically normalize line endings for all text-based files
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
* text=auto

# For the following file types, normalize line endings to LF on
# checkin and prevent conversion to CRLF when they are checked out
# (this is required in order to prevent newline related issues like,
# for example, after the build script is run)
.* text eol=lf
*.css text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.xml text eol=lf
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: gomod
directory: "/tools"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
23 changes: 23 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .github/workflows/automerge.yml

name: Dependabot (auto-merge)

on:
pull_request:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# .github/workflows/codeql.yml

name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '43 0 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- run: |
make build
- uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# .github/workflows/main.yml

name: Test & Build

on:
workflow_call:
push:
branches:
- main
- release/*
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: make test
- uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Go Test Results
path: .test/reports/**-test.xml
reporter: java-junit
fail-on-error: 'true'
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: Test Reports
path: .test/reports/**

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
check-latest: true
- run: make lint
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .github/workflows/release.yml

name: Release

on:
push:
tags:
- 'v*'

jobs:
test:
permissions:
checks: write
uses: ./.github/workflows/main.yml

release:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
version: latest
args: release
if: success()
Loading

0 comments on commit 35df9c0

Please sign in to comment.