Skip to content

Commit 38efadc

Browse files
authored
feat: Initial repository structure and code scaffold (#1)
* Initial repository structure and structs * Adds github release workflow * Stubs out tests * Adding comments * Adding project status badge
1 parent a60511e commit 38efadc

22 files changed

+664
-1
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @devops-kung-fu/the-incredibles

.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /.github/workflows
5+
schedule:
6+
interval: daily
7+
time: "05:00"
8+
timezone: US/Pacific
9+
- package-ecosystem: gomod
10+
directory: /
11+
schedule:
12+
interval: daily
13+
time: "05:00"
14+
timezone: US/Pacific

.github/workflows/codeql-analysis.yml

+67
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: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '32 16 * * 1'
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@v2
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v1
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@v1
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@v1

.github/workflows/go-quality.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Go Quality Checks
2+
on: push
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v2
9+
- name: Setup Go
10+
uses: actions/setup-go@v2
11+
with:
12+
go-version: '1.18'
13+
- name: Install Dependencies
14+
run: |
15+
go version
16+
go install golang.org/x/lint/golint@latest
17+
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
18+
- name: Tests
19+
run: |
20+
go test -v -coverprofile=coverage.out ./...
21+
go tool cover -func=coverage.out
22+
- name: CodeCov
23+
run: bash <(curl -s https://codecov.io/bash)
24+
env:
25+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
26+
- name: Build
27+
run: go build ./...
28+
- name: Vet
29+
run: go vet -v ./...
30+
- name: Lint
31+
run: golint ./...
32+
- name: gocyclo
33+
run: gocyclo .
34+

.github/workflows/release.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: stricly Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
outputs:
13+
upload_url: ${{ steps.upload_url.outputs.upload_url }}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Create Release
20+
id: create_release
21+
uses: actions/create-release@v1
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
tag_name: ${{ github.ref }}
26+
release_name: Release ${{ github.ref }}
27+
body: |
28+
This release contains the following changes:
29+
* Bug fixes
30+
draft: false
31+
prerelease: false

.hookz.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: 2.4.0
2+
sources:
3+
- source: github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest
4+
- source: github.com/devops-kung-fu/hinge@latest
5+
- source: github.com/kisielk/errcheck@latest
6+
- source: golang.org/x/lint/golint@latest
7+
- source: github.com/fzipp/gocyclo/cmd/gocyclo@latest
8+
hooks:
9+
- type: pre-commit
10+
actions:
11+
- name: "git: Pull (Ensure there are no upstream changes that are not local)"
12+
exec: git
13+
args: ["pull"]
14+
- name: "go: Tidy mod file"
15+
exec: go
16+
args: ["mod", "tidy"]
17+
- name: "go: Update all dependencies to latest"
18+
exec: go
19+
args: ["get", "-u", "./..."]
20+
- name: "gofmt: Run gofmt to format the code"
21+
exec: gofmt
22+
args: ["-s", "-w", "**/*.go"]
23+
- name: "golint: Lint all go files"
24+
exec: golint
25+
args: ["./..."] #to error out, add the arg "-set_exit_status"
26+
- name: "errcheck: Ensure that errors are checked"
27+
exec: errcheck
28+
args: ["-ignoretests", "./..."]
29+
- name: "gocyclo: Check cyclomatic complexities"
30+
exec: gocyclo
31+
args: ["-over", "5", "."]
32+
- name: Hinge
33+
exec: hinge
34+
args: ["."]
35+
- name: "go: Build (Ensure pulled modules do not break the build)"
36+
exec: go
37+
args: ["build", "-v", "./..."]
38+
- name: "go: Run all tests"
39+
exec: go
40+
args: ["test", "-v", "-coverprofile=coverage.out", "./..."]
41+
- name: "go: Test coverage"
42+
exec: go
43+
args: ["tool", "cover", "-func=coverage.out"]
44+
- name: "cyclone-dx: Generate a Software Bill of Materials (SBoM)"
45+
exec: cyclonedx-gomod
46+
args: ["-json", "-output", "bomber-cyclonedx-sbom.json"]
47+
- name: "git: Add all changed files during the pre-commit stage"
48+
exec: git
49+
args: ["add", "."]

.vscode/settings.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"cSpell.words": [
3+
"coverprofile",
4+
"cyclomatic",
5+
"cyclonedx",
6+
"errcheck",
7+
"gofmt",
8+
"gomod",
9+
"ignoretests",
10+
"kisielk",
11+
"sbom",
12+
"SPDXID",
13+
"structs"
14+
]
15+
}

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Contributing
2+
3+
## We Develop with Github
4+
5+
We use github to host code, to track issues and feature requests, as well as accept pull requests.
6+
7+
## Use GPG to Sign Your Commits
8+
9+
Only pull requests that have been signed will be accepted. For more information on setting up a GPG key for your Github account see the instructions [here](https://help.github.com/en/articles/managing-commit-signature-verification).
10+
11+
## Contributing Code
12+
13+
All Code Changes Happen Through Pull Requests. Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests and review regularly. We practice a single trunk development method.
14+
15+
- Fork the repo and create your branch from main.
16+
- All code requires test coverage. 100% coverage is the target Add new or modify existing tests.
17+
- If you've changed APIs, update the documentation.
18+
- Ensure the tests pass.
19+
- Make sure your code lints (go)
20+
- Create a pull request.
21+
22+
## Licensing Notes
23+
24+
Any contributions you make will be under the MIT Software License. When you submit code changes, your submissions are understood to be under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.

Makefile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# HELP
2+
# This will output the help for each task
3+
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
4+
.PHONY: help
5+
6+
help: ## This help
7+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
8+
9+
.DEFAULT_GOAL := help
10+
11+
title:
12+
@echo "bomber Makefile"
13+
@echo "---------------"
14+
15+
build: ## Builds the application
16+
go get -u ./...
17+
go mod tidy
18+
go build ./...
19+
20+
test: ## Runs tests and coverage
21+
go test -v -coverprofile=coverage.out ./... && go tool cover -func=coverage.out
22+
23+
check: build ## Tests the pre-commit hooks if they exist
24+
hookz reset --verbose --debug --verbose-output
25+
. .git/hooks/pre-commit
26+
27+
all: title build test ## Makes all targets

0 commit comments

Comments
 (0)