Skip to content

Commit

Permalink
Merge pull request #91 from spiral/3.0
Browse files Browse the repository at this point in the history
3.0 Release
  • Loading branch information
rustatian authored Jan 18, 2021
2 parents a64fe6a + 6f989da commit 1a88ea0
Show file tree
Hide file tree
Showing 81 changed files with 7,067 additions and 3,069 deletions.
108 changes: 49 additions & 59 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,80 @@
name: CI

on: [push, pull_request]
on:
push:
pull_request:
branches:
# Branches from forks have the form 'user:branch-name' so we only run
# this job on pull_request events for branches that look like fork
# branches. Without this we would end up running this job twice for non
# forked PRs, once for the push and then once for opening the PR.
- '**:**'

jobs:
build:
name: Build (PHP ${{ matrix.php }}, Go ${{ matrix.go }}, OS ${{ matrix.os }})
name: Build (Go ${{ matrix.go }} OS ${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
go: [1.14, 1.15]
os: [ubuntu-latest]
env:
GO111MODULE: on
go: [ 1.14, 1.15 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extensions: dom
coverage: xdebug

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Show versions
run: php -v ; composer -V ; go version

- name: Syntax check only (lint)
run: find ./src/ -name "*.php" -print0 | xargs -0 -n1 -P8 php -l

- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
uses: actions/cache@v1
- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest # --prefer-source
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Install Go dependencies
run: go mod download

- name: Run tests

- name: Run golang tests on Windows without codecov
if: ${{ matrix.os == 'windows-latest' }}
run: |
composer update
docker-compose -f ./tests/docker-compose.yml up -d
vendor_php/bin/phpunit --coverage-clover=coverage.xml
go test -v -race -cover -coverprofile=goridge.txt -covermode=atomic
go test -v -race -tags=debug ./pkg/frame
go test -v -race -tags=debug ./pkg/pipe
go test -v -race -tags=debug ./pkg/rpc
go test -v -race -tags=debug ./pkg/socket
- name: Run code coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run golang tests on MacOS or Linux with codecov
if: ${{ matrix.os != 'windows-latest' }}
run: |
if [[ "$CODECOV_TOKEN" != "" ]]; then
curl https://codecov.io/bash -o codecov-bash
chmod +x codecov-bash
./codecov-bash -f goridge.txt
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
mkdir ./coverage-ci
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/frame.txt -covermode=atomic ./pkg/frame
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/pipe
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./pkg/rpc
go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/socket
cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
if: ${{ matrix.os != 'windows-latest' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
file: ./coverage-ci/summary.txt
fail_ci_if_error: false

golangci-check:
name: runner / golangci-lint
golangci-lint:
name: Golang-CI (lint)
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v1
with:
github_token: ${{ secrets.github_token }}
- name: Check out code
uses: actions/checkout@v2

- name: Run linter
uses: golangci/golangci-lint-action@v2 # Action page: <https://github.com/golangci/golangci-lint-action>
with:
version: v1.35 # without patch version
only-new-issues: false # show only new issues if it's a pull request
66 changes: 33 additions & 33 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,43 @@ jobs:
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
29 changes: 20 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
.idea/
composer.lock
vendor/
clover.xml
coveralls.json
tests/server.exe
tests/server
**/vendor
vendor_php
# Created by .ignore support plugin (hsz.mobi)
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
.idea
bench

125 changes: 39 additions & 86 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,47 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

run:
skip-dirs:
- bench
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- gofmt
- govet
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exhaustive
# - funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
# - gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
# - lll
- misspell
- nakedret
# - noctx
- nolintlint
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
# - unparam
- unused
- varcheck
- whitespace

# don't enable:
# - asciicheck
Expand All @@ -82,23 +54,4 @@ linters:
# - nestif
# - prealloc
# - testpackage
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd

run:
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.27.0
# - wsl
Loading

0 comments on commit 1a88ea0

Please sign in to comment.