diff --git a/.github/dependabot.yml b/.github/dependabot.yml index afe2123..ab7509c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,22 +1,22 @@ version: 2 updates: -- package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "monthly" - labels: - - "component/dependencies" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + labels: + - "component/dependencies" -- package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "monthly" - labels: - - "component/dependencies" + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "monthly" + labels: + - "component/dependencies" -- package-ecosystem: "docker" - directory: "/" - schedule: - interval: "monthly" - labels: - - "component/dependencies" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "monthly" + labels: + - "component/dependencies" diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 62beb62..4985f5d 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -1,115 +1,115 @@ name: CI on: - # See the documentation for more intricate event dispatch here: - # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on - push: - branches: - - "!dependabot/*" - - "*" - pull_request: - branches: - - "*" + # See the documentation for more intricate event dispatch here: + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on + push: + branches: + - "!dependabot/*" + - "*" + pull_request: + branches: + - "*" jobs: - build: - name: Build & Lint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - - name: Build - run: go build -v ./cmd/... - - name: Vet - run: go vet ./... - - name: Imports - uses: Jerome1337/goimports-action@v1.0.3 - - name: Format - uses: Jerome1337/gofmt-action@v1.0.4 - - name: Lint - uses: Jerome1337/golint-action@v1.0.2 + build: + name: Build & Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + - name: Build + run: go build -v ./cmd/... + - name: Vet + run: go vet ./... + - name: Imports + uses: Jerome1337/goimports-action@v1.0.3 + - name: Format + uses: Jerome1337/gofmt-action@v1.0.4 + - name: Lint + uses: Jerome1337/golint-action@v1.0.2 - unit: - name: Unit Tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - - name: Unit Tests - run: go test -v -race $(go list ./...) + unit: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + - name: Unit Tests + run: go test -v -race $(go list ./...) - e2e-mem: - name: E2E Tests (Memory Storage) - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - - name: End-to-End Test - run: | - go install --tags e2e ./cmd/chihaya - cat ./dist/example_config.yaml - chihaya --config=./dist/example_config.yaml --debug & - pid=$! - sleep 2 - chihaya e2e --debug - kill $pid + e2e-mem: + name: E2E Tests (Memory Storage) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + - name: End-to-End Test + run: | + go install --tags e2e ./cmd/chihaya + cat ./dist/example_config.yaml + chihaya --config=./dist/example_config.yaml --debug & + pid=$! + sleep 2 + chihaya e2e --debug + kill $pid - e2e-redis: - name: E2E Tests (Redis Storage) - runs-on: ubuntu-latest - services: - redis: - image: redis - ports: ["6379:6379"] - options: --entrypoint redis-server - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - - name: Configure redis storage - run: | - curl -LO https://github.com/jzelinskie/faq/releases/download/0.0.6/faq-linux-amd64 - chmod +x faq-linux-amd64 - ./faq-linux-amd64 '.chihaya.storage = {"config":{"gc_interval":"3m","peer_lifetime":"31m","prometheus_reporting_interval":"1s","redis_broker":"redis://127.0.0.1:6379/0","redis_connect_timeout":"15s","redis_read_timeout":"15s","redis_write_timeout":"15s"},"name":"redis"}' ./dist/example_config.yaml > ./dist/example_redis_config.yaml - cat ./dist/example_redis_config.yaml - - name: End-to-End Test - run: | - go install --tags e2e ./cmd/chihaya - chihaya --config=./dist/example_redis_config.yaml --debug & - pid=$! - sleep 2 - chihaya e2e --debug - kill $pid + e2e-redis: + name: E2E Tests (Redis Storage) + runs-on: ubuntu-latest + services: + redis: + image: redis + ports: [ "6379:6379" ] + options: --entrypoint redis-server + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + - name: Configure redis storage + run: | + curl -LO https://github.com/jzelinskie/faq/releases/download/0.0.6/faq-linux-amd64 + chmod +x faq-linux-amd64 + ./faq-linux-amd64 '.chihaya.storage = {"config":{"gc_interval":"3m","peer_lifetime":"31m","prometheus_reporting_interval":"1s","redis_broker":"redis://127.0.0.1:6379/0","redis_connect_timeout":"15s","redis_read_timeout":"15s","redis_write_timeout":"15s"},"name":"redis"}' ./dist/example_config.yaml > ./dist/example_redis_config.yaml + cat ./dist/example_redis_config.yaml + - name: End-to-End Test + run: | + go install --tags e2e ./cmd/chihaya + chihaya --config=./dist/example_redis_config.yaml --debug & + pid=$! + sleep 2 + chihaya e2e --debug + kill $pid - dist: - name: Helm Template - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Helm - uses: engineerd/configurator@v0.0.5 - with: - name: helm - pathInArchive: linux-amd64/helm - fromGitHubReleases: true - repo: helm/helm - version: ^v3 - urlTemplate: https://get.helm.sh/helm-{{version}}-linux-amd64.tar.gz - token: ${{ secrets.GITHUB_TOKEN }} - - name: Helm Template - working-directory: ./dist/helm/chihaya - run: helm template . --debug + dist: + name: Helm Template + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Helm + uses: engineerd/configurator@v0.0.5 + with: + name: helm + pathInArchive: linux-amd64/helm + fromGitHubReleases: true + repo: helm/helm + version: ^v3 + urlTemplate: https://get.helm.sh/helm-{{version}}-linux-amd64.tar.gz + token: ${{ secrets.GITHUB_TOKEN }} + - name: Helm Template + working-directory: ./dist/helm/chihaya + run: helm template . --debug diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index adbf076..a8d0459 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,26 +1,26 @@ ## Discussion -Long-term discussion and bug reports are maintained via [GitHub Issues]. -Code review is done via [GitHub Pull Requests]. +Long-term discussion and bug reports are maintained via [GitHub Issues]. Code review is done via [GitHub Pull Requests]. Real-time discussion is done via [freenode IRC]. [GitHub Issues]: https://github.com/chihaya/chihaya/issues + [GitHub Pull Requests]: https://github.com/chihaya/chihaya/pulls + [freenode IRC]: http://webchat.freenode.net/?channels=chihaya ## Pull Request Procedure -If you're looking to contribute, search the GitHub for issues labeled "low-hanging fruit". -You can also hop into IRC and ask a developer who's online for their opinion. +If you're looking to contribute, search the GitHub for issues labeled "low-hanging fruit". You can also hop into IRC and +ask a developer who's online for their opinion. -Small, self-describing fixes are perfectly fine to submit without discussion. -However, please do not submit a massive Pull Request without prior communication. -Large, unannounced changes usually lead to confusion and time wasted for everyone. -If you were planning to write a large change, post an issue on GitHub first and discuss it. +Small, self-describing fixes are perfectly fine to submit without discussion. However, please do not submit a massive +Pull Request without prior communication. Large, unannounced changes usually lead to confusion and time wasted for +everyone. If you were planning to write a large change, post an issue on GitHub first and discuss it. -Pull Requests will be treated as "review requests", and we will give feedback we expect to see corrected on style and substance before merging. -Changes contributed via Pull Request should focus on a single issue at a time. -We will not accept pull-requests that try to "sneak" unrelated changes in. +Pull Requests will be treated as "review requests", and we will give feedback we expect to see corrected on style and +substance before merging. Changes contributed via Pull Request should focus on a single issue at a time. We will not +accept pull-requests that try to "sneak" unrelated changes in. The average contribution flow is as follows: @@ -41,19 +41,23 @@ Any new files should include the license header found at the top of every source ### Go -The project follows idiomatic [Go conventions] for style. -If you're just starting out writing Go, you can check out this [meta-package] that documents style idiomatic style decisions you will find in open source Go code. -All files should have `gofmt` executed on them and code should strive to have full coverage of static analysis tools like [govet] and [golint]. +The project follows idiomatic [Go conventions] for style. If you're just starting out writing Go, you can check out +this [meta-package] that documents style idiomatic style decisions you will find in open source Go code. All files +should have `gofmt` executed on them and code should strive to have full coverage of static analysis tools like [govet] +and [golint]. [Go conventions]: https://github.com/golang/go/wiki/CodeReviewComments + [meta-package]: https://github.com/jzelinskie/conventions + [govet]: https://golang.org/cmd/vet + [golint]: https://github.com/golang/lint ### Commit Messages -We follow a rough convention for commit messages that is designed to answer two questions: what changed and why. -The subject line should feature the what and the body of the commit should describe the why. +We follow a rough convention for commit messages that is designed to answer two questions: what changed and why. The +subject line should feature the what and the body of the commit should describe the why. ``` scripts: add the test-cluster command @@ -74,5 +78,6 @@ The format can be described more formally as follows: