Merge pull request #468 from jzelinskie/workflows
Replace TravisCI with GitHub Workflows
This commit is contained in:
commit
2a3bb5bea0
8 changed files with 133 additions and 167 deletions
132
.github/workflows/go.yaml
vendored
Normal file
132
.github/workflows/go.yaml
vendored
Normal file
|
@ -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
|
35
.travis.yml
35
.travis.yml
|
@ -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
|
|
@ -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)
|
||||
|
|
22
dist/travis/check.sh
vendored
22
dist/travis/check.sh
vendored
|
@ -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
|
45
dist/travis/config_memory.yaml
vendored
45
dist/travis/config_memory.yaml
vendored
|
@ -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
|
48
dist/travis/config_redis.yaml
vendored
48
dist/travis/config_redis.yaml
vendored
|
@ -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
|
8
dist/travis/install_reproducible.sh
vendored
8
dist/travis/install_reproducible.sh
vendored
|
@ -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
|
8
dist/travis/install_tip.sh
vendored
8
dist/travis/install_tip.sh
vendored
|
@ -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 ./...
|
Loading…
Add table
Reference in a new issue