Skip to content

npm i

npm i #800

Workflow file for this run

name: Node & Bun CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
# ============================================================
# Node.js matrix (18/20/22)
# ============================================================
test-node:
runs-on: ubuntu-latest
strategy:
matrix:
container: ["node:18-bookworm", "node:20-bookworm", "node:22-bookworm"]
container:
image: ${{ matrix.container }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
SA_PASSWORD: P@assword123
ACCEPT_EULA: 'Y'
ports:
- 1433:1433
mysql:
image: mysql:8.0.31
env:
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
sapase:
image: larsroald/ase-server
ports:
- 5000:5000
oracle:
image: gvenzl/oracle-xe
env:
ORACLE_PASSWORD: P@assword123
ports:
- 1521:1521
steps:
- uses: actions/checkout@v4
# Inside Node container already; no setup-node needed.
- run: curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
- run: curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
- run: apt-get update
- run: ACCEPT_EULA=Y apt-get install -y msodbcsql18
- run: apt-get install -y unixodbc-dev
- run: npm install
- run: npm run lint
- run: npm run tscheck
- run: npm test
# Only run coverage once (pick a single image)
- if: ${{ matrix.container == 'node:18-bookworm' }}
run: npm run coverage
- if: ${{ matrix.container == 'node:18-bookworm' && github.ref == 'refs/heads/master' }}
name: Get Coverage for badge
run: |
SUMMARY="$(npm run coverage | tail -2 | head -1)"
echo "SUMMARY=$SUMMARY"
COVERAGE=$(echo "$SUMMARY" | awk -F':' '{print $2}' | awk '{print $1}')
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
BRANCH_NAME=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $2 "_" $3 }')
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- if: ${{ matrix.container == 'node:18-bookworm' && github.ref == 'refs/heads/master' }}
name: Create the Badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 1a69422f03da7f8155cf94fe66022452
filename: rdb__${{ env.BRANCH }}.json
label: coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: vitest
# ============================================================
# Bun job (no Node, no ODBC deps)
# ============================================================
# test-bun:
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres
# env:
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 5432:5432
# mssql:
# image: mcr.microsoft.com/mssql/server:2019-latest
# env:
# SA_PASSWORD: P@assword123
# ACCEPT_EULA: 'Y'
# ports:
# - 1433:1433
# mysql:
# image: mysql:8.0.31
# env:
# MYSQL_DATABASE: test
# MYSQL_USER: test
# MYSQL_PASSWORD: test
# MYSQL_ROOT_PASSWORD: test
# ports:
# - 3306:3306
# options: >-
# --health-cmd="mysqladmin ping"
# --health-interval=10s
# --health-timeout=5s
# --health-retries=3
# sapase:
# image: larsroald/ase-server
# ports:
# - 5000:5000
# oracle:
# image: gvenzl/oracle-xe
# env:
# ORACLE_PASSWORD: P@assword123
# ports:
# - 1521:1521
# steps:
# - uses: actions/checkout@v4
# - name: Setup Bun (latest)
# uses: oven-sh/setup-bun@v2
# with:
# bun-version: latest
# # (optional) cache Bun tool + package cache for faster runs
# - name: Cache Bun
# uses: actions/cache@v4
# with:
# path: |
# ~/.bun
# ~/.cache/bun
# key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
# restore-keys: ${{ runner.os }}-bun-
# - run: bun install
# - run: bun test --timeout=30000 ./tests/*.bun.test.js