summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml150
1 files changed, 66 insertions, 84 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 92b55666..070350a0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,62 +5,16 @@ on:
pull_request:
jobs:
- php:
- name: Build (PHP ${{ matrix.php }}, ${{ matrix.setup }} setup)
- runs-on: ubuntu-20.04
- timeout-minutes: 6
- strategy:
- fail-fast: false
- matrix:
- php: ['7.3', '7.4', '8.0']
- setup: [basic, lowest]
- steps:
- - name: Set up PHP ${{ matrix.php }}
- uses: shivammathur/setup-php@v2 # action page: <https://github.com/shivammathur/setup-php>
- with:
- php-version: ${{ matrix.php }}
-
- - name: Check out code
- uses: actions/checkout@v2
-
- - name: Syntax check only (lint)
- run: find ./src/ ./tests/ -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
-
- - 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.setup }}-${{ hashFiles('**/composer.json') }}
- restore-keys: ${{ runner.os }}-composer-
-
- - name: Install lowest Composer dependencies
- if: matrix.setup == 'lowest'
- run: composer update --prefer-dist --no-progress --prefer-lowest --ansi
-
- - name: Install basic Composer dependencies
- if: matrix.setup == 'basic'
- run: composer update --prefer-dist --no-progress --ansi
-
- - name: Analyze PHP sources
- run: composer analyze
-
- # TODO write phpunit tests
- #- name: Analyze PHP sources
- # run: composer test
-
golang:
- name: Build (Go ${{ matrix.go }}, PHP ${{ matrix.php }})
- runs-on: ubuntu-20.04
- timeout-minutes: 10
+ name: Build (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 15
strategy:
fail-fast: false
matrix:
- php: ['7.3', '7.4', '8.0']
- go: ['1.14', '1.15']
+ php: [ '7.4', '8.0' ]
+ go: [ '1.14', '1.15' ]
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go>
@@ -71,15 +25,18 @@ jobs:
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
+ if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
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>
+ if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
@@ -87,7 +44,7 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
- run: composer update --prefer-dist --no-progress --ansi
+ 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
@@ -99,25 +56,50 @@ jobs:
- name: Install Go dependencies
run: go mod download
- - name: Run golang tests
+ - name: Run golang tests on Windows without codecov
+ if: ${{ matrix.os == 'windows-latest' }}
+ run: |
+ go test -v -race -cover -tags=debug .
+ go test -v -race -cover -tags=debug ./plugins/rpc
+ go test -v -race -cover -tags=debug ./plugins/rpc/tests
+ go test -v -race -cover -tags=debug ./plugins/config/tests
+ go test -v -race -cover -tags=debug ./plugins/logger/tests
+ go test -v -race -cover -tags=debug ./plugins/server/tests
+ go test -v -race -cover -tags=debug ./plugins/metrics/tests
+ go test -v -race -cover -tags=debug ./plugins/informer/tests
+ go test -v -race -cover -tags=debug ./plugins/resetter/tests
+ go test -v -race -cover -tags=debug ./plugins/http/attributes
+ go test -v -race -cover -tags=debug ./plugins/http/tests
+ go test -v -race -cover -tags=debug ./plugins/gzip/tests
+ go test -v -race -cover -tags=debug ./plugins/static/tests
+ go test -v -race -cover -tags=debug ./plugins/static
+ go test -v -race -cover -tags=debug ./plugins/headers/tests
+ go test -v -race -cover -tags=debug ./plugins/checker/tests
+
+ - name: Run golang tests on Linux and MacOS
+ if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: |
mkdir ./coverage-ci
- go test -race -v -covermode=atomic -coverprofile=./coverage-ci/lib.txt
- go test ./util -race -v -covermode=atomic -coverprofile=./coverage-ci/util.txt
- go test ./service -race -v -covermode=atomic -coverprofile=./coverage-ci/service.txt
- go test ./service/env -race -v -covermode=atomic -coverprofile=./coverage-ci/env.txt
- go test ./service/rpc -race -v -covermode=atomic -coverprofile=./coverage-ci/rpc.txt
- go test ./service/http -race -v -covermode=atomic -coverprofile=./coverage-ci/http.txt
- go test ./service/static -race -v -covermode=atomic -coverprofile=./coverage-ci/static.txt
- go test ./service/limit -race -v -covermode=atomic -coverprofile=./coverage-ci/limit.txt
- go test ./service/headers -race -v -covermode=atomic -coverprofile=./coverage-ci/headers.txt
- go test ./service/metrics -race -v -covermode=atomic -coverprofile=./coverage-ci/metrics.txt
- go test ./service/health -race -v -covermode=atomic -coverprofile=./coverage-ci/health.txt
- go test ./service/gzip -race -v -covermode=atomic -coverprofile=./coverage-ci/gzip.txt
- go test ./service/reload -race -v -covermode=atomic -coverprofile=./coverage-ci/reload.txt
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/lib.txt -covermode=atomic .
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/rpc_config.txt -covermode=atomic ./plugins/rpc
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./plugins/rpc/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/plugin_config.txt -covermode=atomic ./plugins/config/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./plugins/logger/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/server.txt -covermode=atomic ./plugins/server/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./plugins/metrics/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./plugins/informer/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./plugins/resetter/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/attributes.txt -covermode=atomic ./plugins/http/attributes
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/http_tests.txt -covermode=atomic ./plugins/http/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./plugins/gzip/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/static.txt -covermode=atomic ./plugins/static/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/static_root.txt -covermode=atomic ./plugins/static
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./plugins/headers/tests
+ go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/checker.txt -covermode=atomic ./plugins/checker/tests
cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt
- uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action>
+ if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage-ci/summary.txt
@@ -135,20 +117,20 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
- image:
- name: Build docker image
- runs-on: ubuntu-20.04
- timeout-minutes: 10
- steps:
- - name: Check out code
- uses: actions/checkout@v2
-
- - name: Build image
- run: docker build -t roadrunner:local -f Dockerfile .
-
- - name: Scan image
- uses: anchore/scan-action@v2 # action page: <https://github.com/anchore/scan-action>
- with:
- image: roadrunner:local
- fail-build: true
- severity-cutoff: low # negligible, low, medium, high or critical
+# image:
+# name: Build docker image
+# runs-on: ubuntu-20.04
+# timeout-minutes: 10
+# steps:
+# - name: Check out code
+# uses: actions/checkout@v2
+
+# - name: Build image
+# run: docker build -t roadrunner:local -f Dockerfile .
+
+# - name: Scan image
+# uses: anchore/scan-action@v2 # action page: <https://github.com/anchore/scan-action>
+# with:
+# image: roadrunner:local
+# fail-build: true
+# severity-cutoff: low # negligible, low, medium, high or critical