Skip to content

no sudo

no sudo #667

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-bullseye", "node:18-bullseye", "node:20-bullseye"]
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: 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 run test
- run: npm run coverage # Only run the coverage once
- if: ${{ matrix.container == 'node:16-bullseye' && 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/[email protected]
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