Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the server started with the start parameter shut down at the end? #360

Closed
bahmutov opened this issue Apr 29, 2021 · 10 comments 路 Fixed by #915
Closed

Does the server started with the start parameter shut down at the end? #360

bahmutov opened this issue Apr 29, 2021 · 10 comments 路 Fixed by #915
Labels

Comments

@bahmutov
Copy link
Contributor

Seems from https://github.com/bahmutov/cypress-grep-example results that not:

name: ci
on: [push]
jobs:
  cypress-run:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout 馃泿
        uses: actions/checkout@v2

      - name: Install dependencies 馃摝
        uses: cypress-io/github-action@v2
        with:
          # just perform install
          runTests: false

      # run just the smoke tests with "@smoke" string in their names
      - name: Smoke tests 馃挩
        uses: cypress-io/github-action@v2
        with:
          # we have already installed all dependencies above
          install: false
          start: npm start
          # quote the url to be safe against YML parsing surprises
          wait-on: 'http://localhost:8888'
          # pass the grep string
          env: grep=@smoke
          # record the results on the Cypress Dashboard
          # https://on.cypress.io/dashboard-introduction
          record: true
          # tag the smoke tests for quick find
          tag: smoke
        # environment variables while running Cypress
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          # pass GitHub token to allow accurately detecting a build vs a re-run build
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      # if smoke tests passed, run all the tests
      - name: E2E tests 馃挩
        uses: cypress-io/github-action@v2
        with:
          # we have already installed all dependencies above
          install: false
          start: npm start
          # quote the url to be safe against YML parsing surprises
          wait-on: 'http://localhost:8888'
          # record the results on the Cypress Dashboard
          # https://on.cypress.io/dashboard-introduction
          record: true
          tag: all
        # environment variables while running Cypress
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          # pass GitHub token to allow accurately detecting a build vs a re-run build
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The smoke tests pass just fine, but the second action launch is showing an error

Screen Shot 2021-04-29 at 12 12 13 PM

@bahmutov bahmutov self-assigned this Apr 29, 2021
@mswaagman-godaddy
Copy link

mswaagman-godaddy commented Jun 16, 2021

Seeing similar behavior for one of our GHA workflows. Imho the action should just clean up processes rather than leaving them dangling and 馃檹馃徎 the GHA will clean up all leftovers.

Edit: likely GHAs only clean up processes until the entire workflow is complete rather than in between steps!?

@karlhorky
Copy link
Contributor

karlhorky commented Jan 18, 2022

Workaround

Yeah I think the processes don't end - we're trying to start the same server right afterwards, and the port is blocked.

In the meantime, our (somewhat overkill) workaround is:

- run: killall node

Edit: Wonder if this is a general thing with some things running on GitHub Actions (maybe Corepack?):

@commonpike
Copy link

Or more finegrained, if your server runs on 8080

 - run: kill $(lsof -t -i :8080)

@commonpike
Copy link

This is imho a real 'documentation bug' - here
https://github.com/cypress-io/github-action#start-server

it says

the server will run in the background and will shut down after tests complete

and

Note: GitHub cleans up the running server processes automatically. This action does not stop them.

both lines seem to contradict eachother.

@MikeMcC399
Copy link
Collaborator

@commonpike

Is this just a documentation issue for you or do you have an example workflow using the current version of the action (v5) where it is causing you a problem?

@commonpike
Copy link

commonpike commented May 17, 2023

@MikeMcC399 - no, I'm killing the server now and that works. I didn't read the note until I found out the first line was not true :-)

So it's just a documentation issue.

@MikeMcC399
Copy link
Collaborator

Probably if there was a need to start a server a second time, then I would put it into a separate job rather than a step in the same job. I'm not sure if the original issue from 2 years ago is the optimal way to use the action. In any case the documentation could be made more precise.

@MikeMcC399
Copy link
Collaborator

I haven't looked at this too closely, but I think in the original example I would have just deleted the second start: npm start, unless there is some special reason to want to restart the server.

@MikeMcC399
Copy link
Collaborator

@nagash77 nagash77 assigned nagash77 and unassigned bahmutov May 17, 2023
@nagash77 nagash77 removed their assignment May 22, 2023
@github-actions
Copy link

馃帀 This issue has been resolved in version 5.8.0 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants