From a89fbe40b9a495764384de7cc0fc0436223c2356 Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Tue, 28 Nov 2023 09:19:25 -0600 Subject: [PATCH] build: setup basic project CI and issue reporting --- .github/CODEOWNERS | 2 ++ .github/ISSUE_TEMPLATE/bug.yml | 47 ++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 2 ++ .github/ISSUE_TEMPLATE/feature.yml | 31 ++++++++++++++++++++ .github/dependabot.yml | 21 +++++++++++++ .github/workflows/codeql.yaml | 35 ++++++++++++++++++++++ .github/workflows/go.yml | 41 ++++++++++++++++++++++++++ .gitignore | 5 ++++ go.mod | 6 ++-- go.sum | 12 ++++---- makefile | 19 ++++++++++++ 11 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql.yaml create mode 100644 .github/workflows/go.yml create mode 100644 makefile diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e4c830d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @adamdecaf +* @wadearnold diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..c7e6809 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,47 @@ +--- +name: Report an issue +description: + Tell us about something that is not working the way we (probably) intend +body: + - type: input + id: cadeft-version + attributes: + label: cadeft Version + description: What version of cadeft are you using? + validations: + required: true + + - type: textarea + id: intention + attributes: + label: What were you trying to do? + description: > + Describe how you were using the cadeft library. Include code samples, + errors, and stacktraces if appropriate. + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: What did you expect to see? + description: > + A short description on how you expect the code to behave. + validations: + required: true + + - type: textarea + id: current-behavior + attributes: + label: What did you see? + description: Share any logs, errors, or stacktraces that you saw. + validations: + required: true + + - type: textarea + id: reproduction-steps + attributes: + label: How can we reproduce the problem? + description: Help us reproduce the problem by sharing a minimal example. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..341f6af --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +--- +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000..9c670c1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,31 @@ +--- +name: Feature Request +description: + Let us know of a feature or request +body: + - type: textarea + id: cadeft-version + attributes: + label: cadeft Version + description: What version of cadeft are you using? + validations: + required: true + + - type: textarea + id: intention + attributes: + label: What were you trying to do? + description: > + Describe how you were using the cadeft library. Include code samples, + errors, and stacktraces if appropriate. + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: What did you expect to see? + description: > + A short description on how you expect the code to behave. + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a0c0ffb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + + - package-ecosystem: docker + directory: / + schedule: + interval: daily + + - package-ecosystem: bundler + directory: /docs + schedule: + interval: daily + + - package-ecosystem: gomod + directory: / + schedule: + interval: daily diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 0000000..fd7977a --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,35 @@ +# Use https://app.stepsecurity.io/ to improve workflow security +name: CodeQL Analysis + +on: + push: + pull_request: + schedule: + - cron: '0 10 * * 0' + +permissions: + contents: read + +jobs: + CodeQL-Build: + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: go + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + env: + GOOS: js + GOARCH: wasm diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..b55bcca --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,41 @@ +# Use https://app.stepsecurity.io/ to improve workflow security +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + name: Go Build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: stable + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Install make (Windows) + if: runner.os == 'Windows' + run: choco install -y make mingw + + - name: Check + run: make check + env: + GOLANGCI_LINTERS: gosec + + - name: Upload Code Coverage + if: runner.os == 'Linux' + run: bash <(curl -s https://codecov.io/bash) diff --git a/.gitignore b/.gitignore index 3b735ec..3d9c28e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,8 @@ # Go workspace file go.work + + +/bin/ +gitleaks.tar.gz +lint-project.sh \ No newline at end of file diff --git a/go.mod b/go.mod index 6794758..74dea49 100644 --- a/go.mod +++ b/go.mod @@ -19,9 +19,9 @@ require ( github.com/hashicorp/errwrap v1.0.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.7.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9e0a56f..5942bb7 100644 --- a/go.sum +++ b/go.sum @@ -30,14 +30,14 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA= golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/makefile b/makefile new file mode 100644 index 0000000..b65b610 --- /dev/null +++ b/makefile @@ -0,0 +1,19 @@ +.PHONY: check +check: +ifeq ($(OS),Windows_NT) + @echo "Skipping checks on Windows, currently unsupported." +else + @wget -O lint-project.sh https://raw.githubusercontent.com/moov-io/infra/master/go/lint-project.sh + @chmod +x ./lint-project.sh + COVER_THRESHOLD=75.0 ./lint-project.sh +endif + +.PHONY: clean +clean: + @rm -rf ./bin/ ./tmp/ coverage.txt misspell* staticcheck lint-project.sh + +.PHONY: cover-test cover-web +cover-test: + go test -coverprofile=cover.out ./... +cover-web: + go tool cover -html=cover.out