diff options
Diffstat (limited to '.github/workflows/ci-build.yml')
-rw-r--r-- | .github/workflows/ci-build.yml | 85 |
1 files changed, 49 insertions, 36 deletions
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 360c4f30..339c841a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -2,59 +2,72 @@ name: CI on: push: - branches: - tags: + branches: '**' + tags: '**' pull_request: jobs: - build: - name: Build + name: Build (PHP ${{ matrix.php }}, Go ${{ matrix.go }}) runs-on: ubuntu-latest strategy: + fail-fast: false matrix: php: [7.1, 7.2, 7.3, 7.4] + go: [1.12] + env: + GO111MODULE: on steps: - - - name: Set up Go 1.12 + - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v1 with: - go-version: 1.12 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v1 + go-version: ${{ matrix.go }} - - name: Install PHP - uses: shivammathur/setup-php@master + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v1 with: - php-version: ${{ matrix.php }} - extension-csv: dom + 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: Debug if needed - run: | - export DEBUG=${DEBUG:-false} - if [[ "$DEBUG" == "true" ]]; then - env - go env - fi env: DEBUG: ${{ secrets.DEBUG }} + run: if [[ "$DEBUG" == "true" ]]; then env && go env; fi - - 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: Install dependencies and download binary roadrunner - run: | - export GO111MODULE=on - go mod download - composer install --no-interaction --prefer-source - find src/ -name "*.php" -print0 | xargs -0 -n1 -P8 php -l - chmod +x bin/rr && bin/rr get-binary + - 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 + 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 + + - name: Analyze PHP sources + run: composer analyze + + - name: Install Go dependencies + run: go mod download + + - name: Download binary roadrunner + run: php ./bin/rr get-binary - name: Run golang tests run: | @@ -69,7 +82,10 @@ jobs: go test ./service/headers -race -v -coverprofile=headers.txt -covermode=atomic go test ./service/metrics -race -v -coverprofile=metrics.txt -covermode=atomic go test ./service/health -race -v -coverprofile=health.txt -covermode=atomic + - name: Run code coverage + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | if [[ "$CODECOV_TOKEN" != "" ]]; then curl https://codecov.io/bash -o codecov-bash @@ -86,9 +102,6 @@ jobs: ./codecov-bash -f metrics.txt ./codecov-bash -f health.txt fi - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - if: image: name: Build docker image |