From 0e17b1352b47de9771f379a641366ea0dabba4c3 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Thu, 13 Feb 2020 13:34:58 -0500 Subject: [PATCH 1/2] .github: init workflow --- .github/workflows/go.yaml | 132 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 .github/workflows/go.yaml diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..ac72c5b --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,132 @@ +name: CI +on: [push] +jobs: + build: + name: Build & Lint + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Set GOPATH + run: | + # temporary fix for https://github.com/actions/setup-go/issues/14 + echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" + echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Build + run: go build -v ./cmd/... + + - name: Vet + run: go vet ./... + + - name: Format + run: | + go install golang.org/x/tools/cmd/goimports + diff <(goimports -local github.com/chihaya/chihaya -d $(find . -type f -name '*.go' -not -path "./vendor/*")) <(printf "") + + - name: Lint + run: | + go install golang.org/x/lint/golint + (for d in $(go list ./...); do diff <(golint $d) <(printf "") || exit 1; done) + + unit: + name: Unit Tests + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Set GOPATH + run: | + # temporary fix for https://github.com/actions/setup-go/issues/14 + echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" + echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Unit Tests + run: go test -v -race $(go list ./...) + + e2e-mem: + name: E2E Tests (Memory Storage) + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Set GOPATH + run: | + # temporary fix for https://github.com/actions/setup-go/issues/14 + echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" + echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Test + run: | + go install github.com/chihaya/chihaya/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: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Set GOPATH + run: | + # temporary fix for https://github.com/actions/setup-go/issues/14 + echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)" + echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin" + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - 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: Test + run: | + go install github.com/chihaya/chihaya/cmd/chihaya + chihaya --config=./dist/example_redis_config.yaml --debug & + pid=$! + sleep 2 + chihaya e2e --debug + kill $pid From 7ba4b68138787be78d9ba2bc91331f3db849155c Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Thu, 13 Feb 2020 18:42:23 -0500 Subject: [PATCH 2/2] dist: remove all traces of travisci --- .travis.yml | 35 --------------------- README.md | 2 +- dist/travis/check.sh | 22 ------------- dist/travis/config_memory.yaml | 45 --------------------------- dist/travis/config_redis.yaml | 48 ----------------------------- dist/travis/install_reproducible.sh | 8 ----- dist/travis/install_tip.sh | 8 ----- 7 files changed, 1 insertion(+), 167 deletions(-) delete mode 100644 .travis.yml delete mode 100755 dist/travis/check.sh delete mode 100644 dist/travis/config_memory.yaml delete mode 100644 dist/travis/config_redis.yaml delete mode 100755 dist/travis/install_reproducible.sh delete mode 100755 dist/travis/install_tip.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f60a84..0000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: go -go: - - 1.13.x -sudo: false -services: - - redis-server -matrix: - include: - # Using vendored dependencies - - install: - - ./dist/travis/install_reproducible.sh - script: - - ./dist/travis/check.sh - - # Using HEAD of dependencies - - install: - - ./dist/travis/install_tip.sh - script: - - ./dist/travis/check.sh - - allow_failures: - # Using HEAD of dependencies - - install: - - ./dist/travis/install_tip.sh - script: - - ./dist/travis/check.sh -notifications: - irc: - channels: - - irc.freenode.net#chihaya - use_notice: true - skip_join: true - on_success: always - on_failure: always - email: false diff --git a/README.md b/README.md index 7d2a50c..a2a2816 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Chihaya -[![Build Status](https://api.travis-ci.org/chihaya/chihaya.svg?branch=master)](https://travis-ci.org/chihaya/chihaya) +[![Build Status](https://github.com/chihaya/chihaya/actions)](https://github.com/chihaya/chihaya/workflows/CI/badge.svg) [![Docker Repository on Quay.io](https://quay.io/repository/jzelinskie/chihaya/status "Docker Repository on Quay.io")](https://quay.io/repository/jzelinskie/chihaya) [![Go Report Card](https://goreportcard.com/badge/github.com/chihaya/chihaya)](https://goreportcard.com/report/github.com/chihaya/chihaya) [![GoDoc](https://godoc.org/github.com/chihaya/chihaya?status.svg)](https://godoc.org/github.com/chihaya/chihaya) diff --git a/dist/travis/check.sh b/dist/travis/check.sh deleted file mode 100755 index 774092a..0000000 --- a/dist/travis/check.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -ex - -go test -v -race $(go list ./...) -go vet $(go list ./...) -diff <(goimports -local github.com/chihaya/chihaya -d $(find . -type f -name '*.go' -not -path "./vendor/*")) <(printf "") -(for d in $(go list ./...); do diff <(golint $d) <(printf "") || exit 1; done) -go install github.com/chihaya/chihaya/cmd/chihaya - -# Run e2e test with example config. -chihaya --config=./dist/travis/config_memory.yaml --debug& -pid=$! -sleep 2 # wait for Chihaya to start up (gross) -chihaya e2e --debug -kill $pid - -# Run e2e test with redis. -chihaya --config=./dist/travis/config_redis.yaml --debug& -pid=$! -sleep 2 # wait for Chihaya to start up (gross) -chihaya e2e --debug -kill $pid \ No newline at end of file diff --git a/dist/travis/config_memory.yaml b/dist/travis/config_memory.yaml deleted file mode 100644 index e8e4fe5..0000000 --- a/dist/travis/config_memory.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# This config file is used by travis for end-to-end testing. -# See example_config.yaml for a commented, more complete configuration! - -chihaya: - announce_interval: 30m - min_announce_interval: 15m - prometheus_addr: "0.0.0.0:6880" - - http: - addr: "0.0.0.0:6969" - https_addr: "" - tls_cert_path: "" - tls_key_path: "" - read_timeout: 5s - write_timeout: 5s - enable_keepalive: false - idle_timeout: 30s - enable_request_timing: false - announce_routes: - - "/announce" - scrape_routes: - - "/scrape" - allow_ip_spoofing: false - real_ip_header: "x-real-ip" - max_numwant: 100 - default_numwant: 50 - max_scrape_infohashes: 50 - - udp: - addr: "0.0.0.0:6969" - max_clock_skew: 10s - private_key: "paste a random string here that will be used to hmac connection IDs" - enable_request_timing: false - allow_ip_spoofing: false - max_numwant: 100 - default_numwant: 50 - max_scrape_infohashes: 50 - - storage: - name: memory - config: - gc_interval: 3m - peer_lifetime: 31m - shard_count: 1024 - prometheus_reporting_interval: 1s diff --git a/dist/travis/config_redis.yaml b/dist/travis/config_redis.yaml deleted file mode 100644 index 110d484..0000000 --- a/dist/travis/config_redis.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# This config file is used by travis for end-to-end testing. -# See example_config.yaml for a commented, more complete configuration! - -chihaya: - announce_interval: 30m - min_announce_interval: 15m - prometheus_addr: "0.0.0.0:6880" - - http: - addr: "0.0.0.0:6969" - https_addr: "" - tls_cert_path: "" - tls_key_path: "" - read_timeout: 5s - write_timeout: 5s - enable_keepalive: false - idle_timeout: 30s - enable_request_timing: false - announce_routes: - - "/announce" - scrape_routes: - - "/scrape" - allow_ip_spoofing: false - real_ip_header: "x-real-ip" - max_numwant: 100 - default_numwant: 50 - max_scrape_infohashes: 50 - - udp: - addr: "0.0.0.0:6969" - max_clock_skew: 10s - private_key: "paste a random string here that will be used to hmac connection IDs" - enable_request_timing: false - allow_ip_spoofing: false - max_numwant: 100 - default_numwant: 50 - max_scrape_infohashes: 50 - - storage: - name: redis - config: - gc_interval: 3m - peer_lifetime: 31m - prometheus_reporting_interval: 1s - redis_broker: "redis://127.0.0.1:6379/0" - redis_read_timeout: 15s - redis_write_timeout: 15s - redis_connect_timeout: 15s \ No newline at end of file diff --git a/dist/travis/install_reproducible.sh b/dist/travis/install_reproducible.sh deleted file mode 100755 index 4570135..0000000 --- a/dist/travis/install_reproducible.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -ex - -# Install golint and go vet. -go get -u golang.org/x/lint/golint -go get -u golang.org/x/tools/cmd/... - -go mod download \ No newline at end of file diff --git a/dist/travis/install_tip.sh b/dist/travis/install_tip.sh deleted file mode 100755 index 3bbec68..0000000 --- a/dist/travis/install_tip.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -ex - -# Install golint and go vet. -go get -u golang.org/x/lint/golint -go get -u golang.org/x/tools/cmd/... - -go get -t -u ./... \ No newline at end of file