From 5340cda654e46b20e532756ad56b9b6166db1164 Mon Sep 17 00:00:00 2001 From: Type-Style Date: Thu, 11 Jan 2024 09:45:04 +0100 Subject: [PATCH] [Task] #9 build action to use container to enable accessing localhost --- .github/workflows/build.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b99bbeb..adaa96c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,19 +12,17 @@ on: jobs: build-node: runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - + container: node:20 steps: + - run: node --version - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - run: npm ci - run: npm run build --if-present - - run: npm run start + - name: Start server and test server response + run: | + npm start & + sleep 5 # Wait for server to start + curl 127.0.0.1:80 + if [ -n "$(jobs -p)" ]; then + kill $(jobs -p) # Kill background jobs + fi