From ab8188ba2edbf94bce5fbec3c1b03074cb6ca302 Mon Sep 17 00:00:00 2001 From: Richard Carson Derr Date: Sat, 14 Sep 2024 20:11:51 -0400 Subject: [PATCH] feat(humus): initial commit --- .github/ISSUE_TEMPLATE/story.yaml | 28 +++++++++++++++ .github/dependabot.yaml | 13 +++++++ .github/workflows/build.yaml | 42 ++++++++++++++++++++++ .github/workflows/codeql.yaml | 53 ++++++++++++++++++++++++++++ .github/workflows/coverage.yaml | 58 +++++++++++++++++++++++++++++++ .gitignore | 22 ++++++++++++ LICENSE | 21 +++++++++++ README.md | 8 +++++ go.mod | 3 ++ 9 files changed, 248 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/story.yaml create mode 100644 .github/dependabot.yaml create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/codeql.yaml create mode 100644 .github/workflows/coverage.yaml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 go.mod diff --git a/.github/ISSUE_TEMPLATE/story.yaml b/.github/ISSUE_TEMPLATE/story.yaml new file mode 100644 index 0000000..572a03d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/story.yaml @@ -0,0 +1,28 @@ +name: Story +description: Represents stories +title: "story(subject): short description" +labels: ["story"] +body: + - type: textarea + id: description + attributes: + label: Description + description: Please provide an informal, general explanation of the work needed to be done, written from the perspective of the end user. + validations: + required: true + + - type: textarea + id: acceptance-criteria + attributes: + label: Acceptance Criteria + description: List the criteria for accepting this story as done + validations: + required: true + + - type: textarea + id: related-issues + attributes: + label: Related Issues + description: Please reference any other related issue, for example, if this story was created to address a bug report, reference the bug report issue here + validations: + required: false \ No newline at end of file diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..0ae14a0 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,13 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + # Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.) + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: gomod + directory: / + schedule: + interval: daily \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..9f3dc87 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: + - "main" + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + pull_request: + branches: + - "main" + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Lint Go Code + uses: golangci/golangci-lint-action@v6 + with: + version: latest + skip-cache: false + args: --timeout 3m --verbose --print-issued-lines=true --skip-dirs example --skip-files ".*_test.go" + + - name: Build + run: go build ./... + + - name: Test + run: go test -race -cover ./... \ No newline at end of file diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 0000000..8a522c0 --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,53 @@ +name: "CodeQL" + +on: + push: + branches: + - "main" + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + + pull_request: + branches: + - "main" + paths: + - '**.go' + + schedule: + - cron: '34 11 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Custom Go version because of: https://github.com/github/codeql/issues/13992#issuecomment-1711721716 + - uses: actions/setup-go@v5 + with: + go-version: '1.22.0' + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..3f056ae --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,58 @@ +name: Generate code coverage badge + +on: + pull_request: + branches: + - main + paths: + - '**.go' + +permissions: + contents: write + +jobs: + test: + runs-on: ubuntu-latest + name: Update coverage badge + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Run Test + # re-enable new coverage flow once this issue is resolved, https://github.com/golang/go/issues/65570 + run: | + GOEXPERIMENT=nocoverageredesign go test -v ./... -covermode=count -coverprofile=coverage.out + go tool cover -func=coverage.out -o=coverage.out + + - name: Go Coverage Badge # Pass the `coverage.out` output to this action + uses: tj-actions/coverage-badge-go@v2 + with: + filename: coverage.out + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v20 + id: verify-changed-files + with: + files: README.md + + - name: Commit changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "chore(docs): updated coverage badge." + + - name: Push changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ github.head_ref }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9cb1c29 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# VSCode +.vscode + +# 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/ + +# Go workspace file +go.work +dist/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..26432f3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Z5Labs and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa0756b --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# humus + +[![Go Reference](https://pkg.go.dev/badge/github.com/z5labs/humus.svg)](https://pkg.go.dev/github.com/z5labs/humus) +[![Go Report Card](https://goreportcard.com/badge/github.com/z5labs/humus)](https://goreportcard.com/report/github.com/z5labs/humus) +![Coverage](https://img.shields.io/badge/Coverage-0.0%25-brightgreen) +[![build](https://github.com/z5labs/humus/actions/workflows/build.yaml/badge.svg)](https://github.com/z5labs/humus/actions/workflows/build.yaml) + +**humus one stop shop framework for all Z5Labs projects in Go.** \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7573fc5 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/z5labs/humus + +go 1.22.0