This repository contains code of queue worker. Worker runs golangci-lint and reports result to GitHub.
Go (golang), heroku, circleci, docker, redis, postgres.
In golangci-api repo run:
docker-compose up -d
It runs postgres and redis needed for both api and worker.
make run_dev
REPO={OWNER/NAME} PR={PULL_REQUEST_NUMBER} make test_repo_fake_github
e.g. REPO=golangci/golangci-worker PR=39 make test_repo_fake_github
# in golangci-api repo
godotenv -f .env go run ./scripts/emulate_webhook/main.go -repo golangci/golangci-lint -pr 292 -sha 7b605d5c6f5a524e6b0a9cc12ad747222375ad54
Configurate via .env
file. Dev .env
may be like this:
REDIS_URL="redis://localhost:6379"
API_URL="https://api.dev.golangci.com"
WEB_ROOT="https://dev.golangci.com"
USE_CONTAINER_EXECUTOR_PERCENT=100
USE_NEW_REPO_ANALYSIS_PERCENT=100
ORCHESTRATOR_ADDR="http://127.0.0.1:8001"
ORCHESTRATOR_TOKEN=secret_token
Executor is an abstration allowing to run arbitrary shell commands. We support following executor types:
- shell - runs commands on a local machine
- remote shell - runs commands on the specified remote host; it's currently the primary executor
- container - runs commands by sending them to containers orchestrator; containers orchestrator runs container for executing commands; currently we migrate to this executor type.
The recommended way to run executors during development:
# in golangci-api repo
TOKEN=secret_token go run ./cmd/containers_orchestrator/main.go
golangci-api is not needed for running and testing golangci-worker. Not running api can just make log warnings like this:
level=warning msg="Can't get current state: bad status code 404"
To run tests:
make test
For more realistic testing than test_repo_fake_github
use in golangci-api repo GitHub WebHook emulator:
go run app/scripts/emulate_webhook/main.go --repo golangci/golangci-worker --pr 39 --sha fbd0d7bada8a6cfa7adbc58e5901e0d66f7f65b1
See CONTRIBUTING.