Skip to content

beta

beta #658

Workflow file for this run

name: Node.js CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
container: ["node:16-alpine", "node:18-alpine", "node:20-alpine"]
container:
image: ${{ matrix.container }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
# Set health checks to wait until postgres has started
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: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: apk update
- run: apk --no-cache add curl
- run: apk --no-cache add unixodbc
- run: apk add sudo
# - run: apk add unzip
- run: curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.1.1.1-1_amd64.apk
- run: curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.1.1.1-1_amd64.apk
- run: sudo apk add --allow-untrusted msodbcsql18_18.1.1.1-1_amd64.apk
- run: sudo apk add --allow-untrusted mssql-tools18_18.1.1.1-1_amd64.apk
- run: sudo apk add libnsl
- run: sudo apk add gcompat
- run: ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1
# - run: npm install
# - run: wget https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && cp -r instantclient_19_3/* /lib && rm -rf instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && apk --no-cache add libaio && cd /lib && ln -s libnsl.so.2 /usr/lib/libnsl.so.1 && ln -s libc.so /usr/lib/libresolv.so.2
# - run: ldd /__w/rdb/rdb/tests/libsybdrvodb.so
- run: npm install
- run: npm run lint
- run: npm run tscheck
- run: npm run test
- run: npm run coverage
# Only run the coverage once
- if: ${{ matrix.container == 'node:16-alpine' && github.ref == 'refs/heads/master'}}
name: Get Coverage for badge
run: |
# var SUMMARY = [
# '',
# '=============================== Coverage summary ===============================',
# 'Statements : 32.5% ( 39/120 )',
# 'Branches : 38.89% ( 21/54 )',
# 'Functions : 21.74% ( 5/23 )',
# 'Lines : 31.93% ( 38/119 )',
# '================================================================================',
# ''
# ];
# SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )'
# SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%'
SUMMARY="$(npm run coverage | tail -2 | head -1)"
echo "SUMMARY=$SUMMARY"
COVERAGE=$(echo $SUMMARY | awk -F':' '{print $2}' | awk '{print $1}')
echo "COVERAGE=$COVERAGE"
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
BRANCH_NAME=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $2 "_" $3 }')
echo "BRANCH_NAME=$BRANCH_NAME"
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- if: ${{ matrix.container == 'node:16-alpine' && 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
# https://gist.githubusercontent.com/lroal/1a69422f03da7f8155cf94fe66022452/raw/rdb___.json
label: coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: vitest