diff options
author | Valery Piashchynski <[email protected]> | 2020-11-09 14:26:32 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-09 14:26:32 +0300 |
commit | b7b533dbe13d2c1a8e78c0e33a4a388c56884440 (patch) | |
tree | d915b68d0394e249ead23501f5a043e256115c5f | |
parent | e3a1669c8168320318291325f70ca35e2ab2eec3 (diff) |
CI update
-rwxr-xr-x | .github/workflows/ci-build.yml | 26 | ||||
-rwxr-xr-x | pipe_factory.go | 27 | ||||
-rwxr-xr-x | process_state.go | 4 |
3 files changed, 21 insertions, 36 deletions
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e3e09d88..99eb8834 100755 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -57,8 +57,8 @@ jobs: - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction --no-suggest # --prefer-source -# - name: Analyze PHP sources -# run: composer analyze + # - name: Analyze PHP sources + # run: composer analyze - name: Install Go dependencies run: go mod download @@ -73,19 +73,15 @@ jobs: go test -v -race ./plugins/app/tests -tags=debug -coverprofile=app.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 - chmod +x codecov-bash - ./codecov-bash -f lib.txt - ./codecov-bash -f rpc_config.txt - ./codecov-bash -f rpc.txt - ./codecov-bash -f plugin_config.txt - ./codecov-bash -f logger.txt - ./codecov-bash -f app.txt - fi + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lib.txt, rpc_config.txt, rpc.txt, plugin_config.txt, logger.txt, app.txt + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + verbose: true + golangci-check: name: runner / golangci-lint diff --git a/pipe_factory.go b/pipe_factory.go index 9f85bf05..15f38e42 100755 --- a/pipe_factory.go +++ b/pipe_factory.go @@ -2,9 +2,7 @@ package roadrunner import ( "context" - "fmt" "os/exec" - "strings" "github.com/spiral/errors" "github.com/spiral/goridge/v2" @@ -144,24 +142,13 @@ func (f *PipeFactory) SpawnWorker(cmd *exec.Cmd) (WorkerBase, error) { } // errors bundle - var errs []string - if pid, errF := fetchPID(relay); pid != w.Pid() { - if errF != nil { - errs = append(errs, errF.Error()) - } - - errK := w.Kill() - if errK != nil { - errs = append(errs, fmt.Errorf("error killing the worker with PID number %d, Created: %s", w.Pid(), w.Created()).Error()) - } - - if wErr := w.Wait(context.Background()); wErr != nil { - errs = append(errs, wErr.Error()) - } - - if len(errs) > 0 { - return nil, errors.E(op, strings.Join(errs, "/")) - } + if pid, err := fetchPID(relay); pid != w.Pid() { + err = multierr.Combine( + err, + w.Kill(), + w.Wait(context.Background()), + ) + return nil, errors.E(op, err) } // everything ok, set ready state diff --git a/process_state.go b/process_state.go index 1a4c4d65..1291a904 100755 --- a/process_state.go +++ b/process_state.go @@ -2,6 +2,7 @@ package roadrunner import ( "github.com/shirou/gopsutil/process" + "github.com/spiral/errors" ) // ProcessState provides information about specific worker. @@ -25,10 +26,11 @@ type ProcessState struct { // WorkerProcessState creates new worker state definition. func WorkerProcessState(w WorkerBase) (ProcessState, error) { + const op = errors.Op("worker_process state") p, _ := process.NewProcess(int32(w.Pid())) i, err := p.MemoryInfo() if err != nil { - return ProcessState{}, err + return ProcessState{}, errors.E(op, err) } return ProcessState{ |