WIP error message instead of failing the job #45
Workflow file for this run
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
name: Benchmark API Implementation | |
on: | |
push: | |
branches: | |
- '*' | |
schedule: | |
- cron: '30 5 * * 2,4' | |
jobs: | |
benchmark: | |
name: Benchmark Implementation | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['16', '18'] | |
implementation: ['restify', 'plain', 'express', 'koa', 'fastify'] | |
# nodeImage: ['node:14-alpine', 'node:16-alpine', 'node:17-alpine'] | |
runs-on: 'ubuntu-20.04' | |
services: | |
# label for service - since this job doesn't run in a container, this service is accessible at localhost | |
database: | |
image: postgres:14.2-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: acronymapi | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: defaultdb | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# # Note - no docker backend needed, we can just run against the container | |
# backend: | |
# image: ${{ matrix.nodeImage }} | |
# ports: | |
# - 8080:8080 | |
# options: >- | |
# --tty | |
# --workdir /app | |
# --name backend | |
# --entrypoint /bin/sh | |
# --volume "${{ github.workspace }}:/app" | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout the commit triggering this job | |
uses: actions/checkout@v4 | |
# | |
- name: Install Postgres Client | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes --no-install-recommends postgresql-client | |
# | |
- name: Initialize database with initdb | |
run: | | |
PGPASSWORD=password psql -h localhost -U acronymapi --dbname=defaultdb --file=initdb.sql | |
# | |
- name: Setup Node with npm cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
# | |
- name: Install dependencies from package.json | |
run: npm install | |
# - name: Start backend in Docker | |
# uses: docker://docker | |
# with: | |
# args: >- | |
# docker exec --tty --detach backend sh -c "npm install && nohup npm run start:${{matrix.implementation}} >server.log 2>&1" | |
- name: Start backend ${{matrix.implementation}} | |
run: nohup npm run start:${{matrix.implementation}} >myscript.log 2>&1 & | |
env: | |
NODE_ENV: production | |
- name: Run benchmarks with live Postgres server | |
run: npm run benchmark | |
env: | |
PGUSER: acronymapi | |
PGPASSWORD: password | |
PGDATABASE: defaultdb | |
PGHOST: localhost | |
PGPORT: 5432 | |
- name: Read out log | |
run: cat myscript.log |