From dddaaf3b6519067ecf517f7ee40dbed6d362635a Mon Sep 17 00:00:00 2001 From: Joshua Goldstein <92491720+joshua-goldstein@users.noreply.github.com> Date: Fri, 7 Oct 2022 17:17:07 -0500 Subject: [PATCH] chore(CI): cleanup + run CI jobs with Github actions (#304) This PR will add workflows to run Ristretto tests. It also does some basic cleanup and updates the code owners. Notable points: - go version is now pinned in .go-version and referenced by the workflow - test.sh is deprecated since it only was only relevant for TeamCity environments (it was a fancy wrapper on top of `go test -v ./...`) - ci-ristretto-tests and ci-ristretto-lint bring this repository to parity with the dgraph repository - main.yml was removed since we are no longer automatically closing issues - Coveralls now used for test coverage - Issue template updated - Pull Request template added --- .github/CODEOWNERS | 2 +- .github/ISSUE_TEMPLATE | 1 - .github/ISSUE_TEMPLATE/bug_report.yml | 62 +++++++++++++++++++ .../ISSUE_TEMPLATE/documentation_request.yml | 30 +++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 49 +++++++++++++++ .github/ISSUE_TEMPLATE/question.yml | 14 +++++ .github/PULL_REQUEST_TEMPLATE.md | 29 +++++++++ .github/workflows/ci-ristretto-lint.yml | 27 ++++++++ .github/workflows/ci-ristretto-tests.yml | 34 ++++++++++ .github/workflows/main.yml | 24 ------- .go-version | 1 + .golangci.yml | 22 +++++++ README.md | 7 +-- test.sh | 20 ------ 14 files changed, 272 insertions(+), 50 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation_request.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/question.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/ci-ristretto-lint.yml create mode 100644 .github/workflows/ci-ristretto-tests.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .go-version create mode 100644 .golangci.yml delete mode 100755 test.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a29aeab9..2cbef4ca 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # CODEOWNERS info: https://help.github.com/en/articles/about-code-owners # Owners are automatically requested for review for PRs that changes code # that they own. -* @manishrjain @martinmr @jarifibrahim +* @akon-dey @nosql22 @joshua-goldstein @skrdgraph diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE deleted file mode 100644 index 6a7ff22b..00000000 --- a/.github/ISSUE_TEMPLATE +++ /dev/null @@ -1 +0,0 @@ -**GitHub Issues are deprecated. Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35/ristretto/40) for reporting issues about this repository.** diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..f9da1321 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,62 @@ +name: "🐞 Bug Report" +description: File a bug report +title: "[BUG]: " +labels: ["kind/bug", "status/triage"] +body: + - type: markdown + attributes: + value: | + Thank you for reporting an issue. + If you suspect this could be a bug, please follow this template. + - type: textarea + attributes: + label: What version of Ristretto are you using? + description: Copy and paste the tag or commit hash used in your application's go.mod file. + placeholder: | + Paste here. + validations: + required: false + - type: textarea + attributes: + label: What version of Go are you using? + description: Copy and paste all you see using the command 'go version'. + placeholder: | + Paste here. + validations: + required: false + - type: dropdown + attributes: + label: Have you tried reproducing the issue with the latest release? + options: + - "Yes" + - "No" + validations: + required: false + - type: textarea + attributes: + label: What is the hardware spec (RAM, CPU, OS)? + description: Share all possible context of your machine. + placeholder: | + Type here. + validations: + required: true + - type: textarea + attributes: + label: What steps will reproduce the bug? + description: Enter details about your bug (command/config used to set up Ristretto). + placeholder: | + Type here. + validations: + required: true + - type: textarea + attributes: + label: Expected behavior and actual result. + description: Enter details about your expectations. + placeholder: | + Type here. + validations: + required: false + - type: textarea + attributes: + label: Additional information + description: Tell us anything else you think we should know. diff --git a/.github/ISSUE_TEMPLATE/documentation_request.yml b/.github/ISSUE_TEMPLATE/documentation_request.yml new file mode 100644 index 00000000..8363ff58 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_request.yml @@ -0,0 +1,30 @@ +name: "📃 Documentation Request" +description: Suggest improvements, additions, or revisions to Ristretto documentation +title: "[Documentation]: <Title>" +labels: ["area/documentation", "status/triage"] +body: + - type: markdown + attributes: + value: | + Thank you for reporting an issue. + If you think Ristretto's documentation is lacking, please explain it here. + - type: textarea + attributes: + label: What version of Ristretto is the target? + description: Is it the latest version? + placeholder: | + Type here. + validations: + required: false + - type: textarea + attributes: + label: Documentation. + description: Explain which part of the documentation is lacking. + placeholder: | + Type here. + validations: + required: true + - type: textarea + attributes: + label: Additional information. + description: Tell us anything else you think we should know. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..59777075 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,49 @@ +name: "⚡ Feature Request" +description: Suggest a new feature +title: "[FEATURE]: <Title>" +labels: ["kind/feature ", "status/triage"] +body: + - type: markdown + attributes: + value: | + Thank you for reporting an issue. + If you think we can make Ristretto better, describe your feature request here. + Note: Feature requests are judged based on user experience and modeled on + [Go Experience Reports](https://github.com/golang/go/wiki/ExperienceReports). + These reports should focus on the problems - they should not focus on and need not propose solutions. + - type: dropdown + attributes: + label: Have you tried Ristretto before this proposal? and did not find anything similar? + options: + - "Yes" + - "No" + validations: + required: false + - type: textarea + attributes: + label: What you wanted to do. + description: Enter details about your expectations. + placeholder: | + Type here. + validations: + required: true + - type: textarea + attributes: + label: What you actually did. + description: Enter details about your experience with Ristretto. + placeholder: | + Type here. + validations: + required: false + - type: textarea + attributes: + label: Why wasn't it great, with examples. + description: Enter details about your expectations. + placeholder: | + Type here. + validations: + required: false + - type: textarea + attributes: + label: Additional information. + description: Any external references to support your case. diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000..f0368bf6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,14 @@ +name: "🙋 Question" +description: Question related to Ristretto +title: "[QUESTION]: <Title>" +labels: ["kind/question ", "status/triage"] +body: + - type: markdown + attributes: + value: | + The issue tracker is primarily for code related issues, bug reports, missing documentation, or feature requests. + - If you have a question, please consider asking it on https://discuss.dgraph.io + - type: textarea + attributes: + label: Question. + description: Ask your Question. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..64d1bf16 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ +<!-- + Change Github PR Title + + Your title must be in the following format: + - `topic(Area): Feature` + - `Topic` must be one of `build|ci|docs|feat|fix|perf|refactor|chore|test` + + Sample Titles: + - `feat(Enterprise)`: Backups can now get credentials from IAM + - `fix(Query)`: Skipping floats that cannot be Marshalled in JSON + - `perf: [Breaking]` json encoding is now 35% faster if SIMD is present + - `chore`: all chores/tests will be excluded from the CHANGELOG + --> + +## Problem + <!-- + Please add a description with these things: + 1. Explain the problem by providing a good description. + 2. If it fixes any GitHub issues, say "Fixes #GitHubIssue". + 3. If it corresponds to a Jira issue, say "Fixes DGRAPH-###". + 4. If this is a breaking change, please prefix `[Breaking]` in the title. In the description, please put a note with exactly who these changes are breaking for. + --> + +## Solution + <!-- + Please add a description with these things: + 1. Explain the solution to make it easier to review the PR. + 2. Make it easier for the reviewer by describing complex sections with comments. + --> \ No newline at end of file diff --git a/.github/workflows/ci-ristretto-lint.yml b/.github/workflows/ci-ristretto-lint.yml new file mode 100644 index 00000000..68668e57 --- /dev/null +++ b/.github/workflows/ci-ristretto-lint.yml @@ -0,0 +1,27 @@ +name: ci-ristretto-lint +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 * * * *" +jobs: + go-lint: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golang-lint + env: + # prevent OOM + GOGC: 10 + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.36 + only-new-issues: true + args: --timeout=10m + skip-go-installation: true diff --git a/.github/workflows/ci-ristretto-tests.yml b/.github/workflows/ci-ristretto-tests.yml new file mode 100644 index 00000000..90df96fe --- /dev/null +++ b/.github/workflows/ci-ristretto-tests.yml @@ -0,0 +1,34 @@ +name: ci-ristretto-tests +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "30 * * * *" +jobs: + ristretto-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Get Go Version + run: | + #!/bin/bash + DEFAULT_VERSION="1.17" + GOVERSION=$({ [ -f .go-version ] && cat .go-version; } || echo $DEFAULT_VERSION) + echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GOVERSION }} + - name: Run Unit Tests + run: go test -race -covermode atomic -coverprofile=covprofile ./... + - name: Install Goveralls + run: go install github.com/mattn/goveralls@latest + - name: Send Coverage Results + env: + COVERALLS_TOKEN: ${{ secrets.COVERALLSIO_TOKEN }} + run: goveralls -coverprofile=covprofile + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index c28755f6..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Issue Closer - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - issues: - types: [ opened ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Close Issue - uses: peter-evans/close-issue@v1.0.1 - with: - comment: | - **Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35/ristretto/40) for reporting issues about this repository.** diff --git a/.go-version b/.go-version new file mode 100644 index 00000000..b8f1e3fd --- /dev/null +++ b/.go-version @@ -0,0 +1 @@ +1.17.11 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..b6f2150e --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,22 @@ +run: + tests: false + skip-dirs: + - contrib + +linters-settings: + lll: + line-length: 120 + +linters: + disable-all: true + enable: + #- errcheck + #- ineffassign + - gas + #- gofmt + #- golint + #- gosimple + #- govet + - lll + #- varcheck + #- unused diff --git a/README.md b/README.md index f4bb28cd..779ad271 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ # Ristretto [![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/dgraph-io/ristretto) +[![ci-ristretto-tests](https://github.com/dgraph-io/ristretto/actions/workflows/ci-ristretto-tests.yml/badge.svg)](https://github.com/dgraph-io/ristretto/actions/workflows/ci-ristretto-tests.yml) +[![ci-ristretto-lint](https://github.com/dgraph-io/ristretto/actions/workflows/ci-ristretto-lint.yml/badge.svg)](https://github.com/dgraph-io/ristretto/actions/workflows/ci-ristretto-lint.yml) +[![Coverage Status](https://coveralls.io/repos/github/dgraph-io/ristretto/badge.svg?branch=main)](https://coveralls.io/github/dgraph-io/ristretto?branch=main) [![Go Report Card](https://img.shields.io/badge/go%20report-A%2B-brightgreen)](https://goreportcard.com/report/github.com/dgraph-io/ristretto) -[![Coverage](https://gocover.io/_badge/github.com/dgraph-io/ristretto)](https://gocover.io/github.com/dgraph-io/ristretto) -![Tests](https://github.com/dgraph-io/ristretto/workflows/tests/badge.svg) Ristretto is a fast, concurrent cache library built with a focus on performance and correctness. The motivation to build Ristretto comes from the need for a contention-free cache in [Dgraph][]. -**Use [Discuss Issues](https://discuss.dgraph.io/tags/c/issues/35/ristretto/40) for reporting issues about this repository.** - [Dgraph]: https://github.com/dgraph-io/dgraph ## Features diff --git a/test.sh b/test.sh deleted file mode 100755 index d53b32d4..00000000 --- a/test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh - -starttest() { - set -e - GO111MODULE=on go test -race ./... -} - -if [ -z "${TEAMCITY_VERSION}" ]; then - # running locally, so start test in a container - # TEAMCITY_VERSION=local will avoid recursive calls, when it would be running in container - docker run --rm --name ristretto-test -ti \ - -v `pwd`:/go/src/github.com/dgraph-io/ristretto \ - --workdir /go/src/github.com/dgraph-io/ristretto \ - --env TEAMCITY_VERSION=local \ - golang:1.13 \ - sh test.sh -else - # running in teamcity, since teamcity itself run this in container, let's simply run this - starttest -fi