Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
djschleen committed Jan 11, 2023
0 parents commit 120dc1e
Show file tree
Hide file tree
Showing 36 changed files with 2,773 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @devops-kung-fu/the-incredibles
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /.github/workflows
schedule:
interval: daily
time: "05:00"
timezone: US/Pacific
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
time: "05:00"
timezone: US/Pacific
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '32 16 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# 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

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
43 changes: 43 additions & 0 deletions .github/workflows/go-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Go Quality Checks
on: push
jobs:
tests:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
-
name: Install Dependencies
run: |
go version
go install golang.org/x/lint/golint@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
-
name: Test
run: |
go test -v -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
-
name: CodeCov
run: bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
-
name: Build
run: go build
-
name: Vet
run: go vet -v
-
name: Lint
run: golint ./...
-
name: gocyclo
run: gocyclo .

45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
-
name: Generate SBOM
uses: anchore/sbom-action@v0
with:
artifact-name: meadow.cyclonedx.json
path: .
-
name: Release SBOM
uses: anchore/sbom-action/publish-sbom@v0
with:
sbom-artifact-match: ".*\\.cyclonedx.json$"

24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

.DS_Store

*.glade~
*.glade#

meadow

gen/
43 changes: 43 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
project_name: meadow

builds:
-
binary: meadow
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64

release:
prerelease: auto

universal_binaries:
- replace: true

brews:
-
name: meadow
homepage: "https://github.com/devops-kung-fu/meadow"
tap:
owner: devops-kung-fu
name: homebrew-tap
commit_author:
name: djschleen
email: [email protected]

checksum:
name_template: 'checksums.txt'

nfpms:
-
maintainer: DevOps Kung Fu Mafia <[email protected]>
description: "Generates Go code which connects to GTK objects defined in a Glade file"
homepage: https://github.com/devops-kung-fu/meadow
license: MPL
formats:
- deb
- rpm

54 changes: 54 additions & 0 deletions .hookz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: 2.4.0
sources:
- source: github.com/anchore/syft/cmd/syft@latest
- source: github.com/devops-kung-fu/hinge@latest
- source: github.com/kisielk/errcheck@latest
- source: golang.org/x/lint/golint@latest
- source: github.com/fzipp/gocyclo/cmd/gocyclo@latest
hooks:
- type: pre-commit
actions:
- name: "make: Remove any test or temporary files"
exec: make
args: ["clean"]
- name: "git: Pull (Ensure there are no upstream changes that are not local)"
exec: git
args: ["pull"]
- name: "go: Tidy mod file"
exec: go
args: ["mod", "tidy"]
- name: "go: Update all dependencies to latest"
exec: go
args: ["get", "-u", "./..."]
- name: "gofmt: Run gofmt to format the code"
exec: gofmt
args: ["-s", "-w", "**/*.go"]
- name: "golint: Lint all go files"
exec: golint
args: ["-set_exit_status", "./..."]
- name: "errcheck: Ensure that errors are checked"
exec: errcheck
args: ["-ignoretests", "./..."]
- name: "gocyclo: Check cyclomatic complexities"
exec: gocyclo
args: ["-over", "4", "."]
- name: Hinge
exec: hinge
args: ["."]
- name: "go: Build (Ensure pulled modules do not break the build)"
exec: go
args: ["build", "-v", "./..."]
- name: "go: Run all tests"
exec: go
args: ["test", "-v", "-coverprofile=coverage.out", "./..."]
- name: "go: Test coverage"
exec: go
args: ["tool", "cover", "-func=coverage.out"]
- name: "syft: Generate a Software Bill of Materials (SBoM)"
script: "
#!/bin/bash \n
syft . -o cyclonedx-json=sbom/meadow.cyclonedx.json &> /dev/null \n
"
- name: "git: Add all changed files during the pre-commit stage"
exec: git
args: ["add", "."]
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug (generate)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"args": ["--debug=true", "generate", "test/ui.glade"]
},
{
"name": "Debug (validate)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"args": ["--debug=true", "validate", "test/ui.glade"]
},
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"afero",
"strcase"
]
}
Loading

0 comments on commit 120dc1e

Please sign in to comment.