summaryrefslogtreecommitdiff
path: root/--github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '--github/workflows')
-rw-r--r----github/workflows/codeql-analysis.yml66
-rw-r--r----github/workflows/linters.yml18
-rw-r--r----github/workflows/linux.yml104
-rw-r--r----github/workflows/windows.yml96
4 files changed, 284 insertions, 0 deletions
diff --git a/--github/workflows/codeql-analysis.yml b/--github/workflows/codeql-analysis.yml
new file mode 100644
index 00000000..dc4a2349
--- /dev/null
+++ b/--github/workflows/codeql-analysis.yml
@@ -0,0 +1,66 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ master ]
+ schedule:
+ - cron: '0 15 * * 6'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-20.04
+
+ strategy:
+ fail-fast: false
+ matrix:
+ # Override automatic language detection by changing the below list
+ # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
+ language: [ 'go' ]
+ # Learn more...
+ # 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
+
+ # 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
+
+ # ℹī¸ 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
+
+ #- run: |
+ # make bootstrap
+ # make release
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v1
diff --git a/--github/workflows/linters.yml b/--github/workflows/linters.yml
new file mode 100644
index 00000000..cee7085c
--- /dev/null
+++ b/--github/workflows/linters.yml
@@ -0,0 +1,18 @@
+name: Linters
+
+on: [push, pull_request]
+
+jobs:
+ golangci-lint:
+ name: Golang-CI (lint)
+ runs-on: ubuntu-20.04
+ steps:
+ - 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.40 # without patch version
+ only-new-issues: false # show only new issues if it's a pull request
+ args: --timeout=10m
diff --git a/--github/workflows/linux.yml b/--github/workflows/linux.yml
new file mode 100644
index 00000000..62987771
--- /dev/null
+++ b/--github/workflows/linux.yml
@@ -0,0 +1,104 @@
+name: Linux
+
+on:
+ push:
+ branches:
+ - master
+ - beta
+ - stable
+ tags-ignore:
+ - '**'
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+jobs:
+ golang:
+ name: Build (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [ "7.4", "8.0" ]
+ go: [ "1.16" ]
+ os: [ ubuntu-20.04 ]
+ steps:
+ - name: Set up Go ${{ matrix.go }}
+ uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go>
+ with:
+ go-version: ${{ matrix.go }}
+
+ - name: Set up PHP ${{ matrix.php }}
+ uses: shivammathur/setup-php@v2 # action page: <https://github.com/shivammathur/setup-php>
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: sockets
+
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Get Composer Cache Directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Init Composer Cache # Docs: <https://git.io/JfAKn#php---composer>
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install Composer dependencies
+ run: cd tests && composer update --prefer-dist --no-progress --ansi
+
+ - name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
+ uses: actions/cache@v2
+ with:
+ 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 golang tests on Linux
+ run: |
+ docker-compose -f ./tests/docker-compose.yaml up -d
+ mkdir ./coverage-ci
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/transport/pipe
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/transport/socket
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pool.txt -covermode=atomic ./pkg/pool
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker.txt -covermode=atomic ./pkg/worker
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/bst.txt -covermode=atomic ./pkg/bst
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker_stack.txt -covermode=atomic ./pkg/worker_watcher
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http_config.txt -covermode=atomic ./plugins/http/config
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server_cmd.txt -covermode=atomic ./plugins/server
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http.txt -covermode=atomic ./tests/plugins/http
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./tests/plugins/informer
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/reload.txt -covermode=atomic ./tests/plugins/reload
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server.txt -covermode=atomic ./tests/plugins/server
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/service.txt -covermode=atomic ./tests/plugins/service
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/status.txt -covermode=atomic ./tests/plugins/status
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/config.txt -covermode=atomic ./tests/plugins/config
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./tests/plugins/gzip
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./tests/plugins/headers
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./tests/plugins/logger
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./tests/plugins/metrics
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/redis.txt -covermode=atomic ./tests/plugins/redis
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./tests/plugins/resetter
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./tests/plugins/rpc
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/kv_plugin.txt -covermode=atomic ./tests/plugins/kv
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/broadcast_plugin.txt -covermode=atomic ./tests/plugins/broadcast
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/websockets.txt -covermode=atomic ./tests/plugins/websockets
+ go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/ws_origin.txt -covermode=atomic ./plugins/websockets
+ docker-compose -f ./tests/docker-compose.yaml down
+ cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt
+
+ - uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
+ with:
+ file: ./coverage-ci/summary.txt
+ fail_ci_if_error: false
+
diff --git a/--github/workflows/windows.yml b/--github/workflows/windows.yml
new file mode 100644
index 00000000..f23f9b5d
--- /dev/null
+++ b/--github/workflows/windows.yml
@@ -0,0 +1,96 @@
+name: Windows
+
+on:
+ push:
+ branches:
+ - master
+ - beta
+ - stable
+ tags-ignore:
+ - '**'
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+jobs:
+ golang:
+ name: Build (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [ "8.0" ]
+ go: [ "1.16" ]
+ os: [ windows-latest ]
+ steps:
+ - name: Set up Go ${{ matrix.go }}
+ uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go>
+ with:
+ go-version: ${{ matrix.go }}
+
+ - name: Set up PHP ${{ matrix.php }}
+ uses: shivammathur/setup-php@v2 # action page: <https://github.com/shivammathur/setup-php>
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: sockets
+
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Get Composer Cache Directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Init Composer Cache # Docs: <https://git.io/JfAKn#php---composer>
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install Composer dependencies
+ run: cd tests && composer update --prefer-dist --no-progress --ansi
+
+ - name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
+ uses: actions/cache@v2
+ with:
+ 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 golang tests on Windows
+ run: |
+ docker-compose -f ./tests/docker-compose.yaml up -d
+ go test -v -race ./pkg/transport/pipe
+ go test -v -race ./pkg/transport/socket
+ go test -v -race ./pkg/pool
+ go test -v -race ./pkg/worker
+ go test -v -race ./pkg/bst
+ go test -v -race ./pkg/worker_watcher
+ go test -v -race ./plugins/http/config
+ go test -v -race ./plugins/server
+ go test -v -race ./tests/plugins/http
+ go test -v -race ./tests/plugins/informer
+ go test -v -race ./tests/plugins/reload
+ go test -v -race ./tests/plugins/server
+ go test -v -race ./tests/plugins/service
+ go test -v -race ./tests/plugins/status
+ go test -v -race ./tests/plugins/config
+ go test -v -race ./tests/plugins/gzip
+ go test -v -race ./tests/plugins/headers
+ go test -v -race ./tests/plugins/logger
+ go test -v -race ./tests/plugins/metrics
+ go test -v -race ./tests/plugins/redis
+ go test -v -race ./tests/plugins/resetter
+ go test -v -race ./tests/plugins/rpc
+ go test -v -race ./tests/plugins/kv
+ go test -v -race ./tests/plugins/broadcast
+ go test -v -race ./tests/plugins/websockets
+ go test -v -race ./plugins/websockets
+ docker-compose -f ./tests/docker-compose.yaml down