<p>The pipeline is configured correctly, you were just missing one piece of the puzzle called <a href="https://docs.github.com/en/actions/using-containerized-services/about-service-containers" rel="nofollow noreferrer">service containers</a>.</p>
<p>Basically, the service containers also known as sidecars will run alongside your &quot;main&quot; pipeline logic and support your commands. In your case, you will run the <code>npm run dev</code> in a service container once the build job starts and when the <code>npx cypress run</code> runs it will have a dev server to connect to.</p>
<p>Follow the example GitHub added for <a href="https://docs.github.com/en/actions/using-containerized-services/creating-redis-service-containers" rel="nofollow noreferrer">Redis</a></p>

CC BY-SA 4.0
2022-01-09T12:49:02.383Z
2022-01-09T12:49:02.383Z
Totem
<p>I have a CI pipeline setup using Github Action/Workflows, where I want to run Cypress Automated tests; however I am having some problems of when trying to run my dev server. Let me show you my pipeline:</p>
<pre><code>name: Nuxt CI Pipeline

on:
  push:
    branches: [ CI-pipeline ]
  # pull_request:
  #   branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [ 14.x ]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - name: Make envfile
      uses: SpicyPizza/create-envfile@v1
      with:
        envkey_ENV: staging
        file_name: .env
    - run: npm ci
    - run: npm run dev
    - run: | 
        cd e2e
        ls -l
        npm ci
        npx cypress run
</code></pre>
<p>Now I want to spin up the devserver and run the tests on that port usually 3000; however the problem is when the command <code>npm run dev</code> is executed, the pipeline keeps on waiting there and doesn't move forward to the next commands, which makes sense as devserver doesn't return a response – it listens on that port until explicitly closed. I'm stuck here. My knowledge of devops is the bare minimum; can someone point out what I am missing?</p>

<continuous-integration><github-actions>
Run a dev server in CI pipeline
uneeb meer
# Run a dev server in CI pipeline

(Asked by: username_0 on 2021-12-30)

I have a CI pipeline setup using Github Action/Workflows, where I want to run Cypress Automated tests; however I am having some problems of when trying to run my dev server. Let me show you my pipeline:
name: Nuxt CI Pipeline

on:
  push:
    branches: [ CI-pipeline ]
  # pull_request:
  #   branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [ 14.x ]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - name: Make envfile
      uses: SpicyPizza/create-envfile@v1
      with:
        envkey_ENV: staging
        file_name: .env
    - run: npm ci
    - run: npm run dev
    - run: | 
        cd e2e
        ls -l
        npm ci
        npx cypress run

Now I want to spin up the devserver and run the tests on that port usually 3000; however the problem is when the command npm run dev is executed, the pipeline keeps on waiting there and doesn't move forward to the next commands, which makes sense as devserver doesn't return a response – it listens on that port until explicitly closed. I'm stuck here. My knowledge of devops is the bare minimum; can someone point out what I am missing?

**Tags:** continuous-integration, github-actions


---

## 1 answers

### Answer by username_1 on 2022-01-09. Score: 1

The pipeline is configured correctly, you were just missing one piece of the puzzle called [service containers](https://docs.github.com/en/actions/using-containerized-services/about-service-containers).

Basically, the service containers also known as sidecars will run alongside your "main" pipeline logic and support your commands. In your case, you will run the `npm run dev` in a service container once the build job starts and when the `npx cypress run` runs it will have a dev server to connect to.

Follow the example GitHub added for [Redis](https://docs.github.com/en/actions/using-containerized-services/creating-redis-service-containers)


---

