Merge pull request #2 from lgrdev/1-utiliser-systeminformationio #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: testdb | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
matrix: | |
node-version: [20.12.2] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Create .env file | |
run: | | |
echo DATABASE_URL="postgresql://postgres:postgres@localhost:5432/testdb?schema=public" >> .env | |
echo JWTPRIVATEKEY="TestonsCeJwt" >> .env | |
echo APIKEY="xxxxxx" >> .env | |
echo SECRETID="YYYYY" >> .env | |
echo PORT=3000 >> .env | |
echo BASE_URL="http://localhost" >> .env | |
- run: npm ci | |
- run: npx prisma generate | |
- run: npx prisma migrate dev | |
- run: npm run build --if-present | |
- name: Start server | |
run: | | |
npm start & | |
sleep 5 # give server some time to start | |
- run: npm test |