Skip to content
20 changes: 8 additions & 12 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: SASjs CLI Deploy

on:
push:
branches:
- main

env:
NODE_VERSION: lts/jod

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
Expand All @@ -43,7 +39,7 @@ jobs:
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}
cache: npm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
27 changes: 7 additions & 20 deletions .github/workflows/run-tests-windows.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Run mocked tests on Windows

on:
pull_request:

env:
NODE_VERSION: lts/jod

jobs:
test:
runs-on: windows-latest

strategy:
matrix:
node-version: [22]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}
cache: npm

- uses: ssciwr/doxygen-install@v1
with:
version: '1.9.3'

- name: Check doxygen version
run: doxygen -v

- name: Create .env file for sasjs/server
run: |
echo RUN_TIMES=js >> .env
Expand All @@ -49,12 +42,6 @@ jobs:
npm config set registry http://registry.npmjs.org
npm ci

- name: Check code style
run: npm run lint

- name: Install rimraf
run: npm i -g rimraf

- name: Build Project
run: npm run build

Expand Down
129 changes: 89 additions & 40 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,146 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
pull_request:

jobs:
test:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22]
node-version: [22, 24]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Check code style
run: npm run lint

audit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install production dependencies
run: npm ci --omit=dev --ignore-scripts
- name: Check npm audit
run: npm audit --omit=dev --audit-level=low

- name: Install production dependencies (fail if any warning)
run: |
npm ci --omit=dev --ignore-scripts
# sh ./npm-production-install.sh
- name: Install dependencies
run: |
npm config set registry http://registry.npmjs.org
npm ci

docs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Install Compodoc
run: npm i -g @compodoc/compodoc

- name: Generate development documentation and test level of documentation coverage
- name: Generate docs and check coverage
run: npm run doc

- name: Check code style
run: npm run lint

build-and-smoke:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Build Project
run: npm run build

- name: Test Package Install
run: |
npm version "5.0.0" --no-git-tag-version
npm pack
npm install -g ./sasjs-cli-5.0.0.tgz
sasjs v

- name: Run smoke tests
run: sh ./test.sh

unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Install Doxygen
run: sudo apt-get install -y doxygen

# Mocked (*.spec.ts) tests will be conducted during this step
- name: Build Project
run: npm run build
- name: Install sasjs CLI globally
run: |
npm version "5.0.0" --no-git-tag-version
npm pack
npm install -g ./sasjs-cli-5.0.0.tgz
- name: Generate coverage report
uses: artiomtr/jest-coverage-report-action@v2.0-rc.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-script: npx jest --config=jest.config.js --silent --runInBand --ci --coverage --testLocationInResults --json --outputFile="report.json"

- name: Install PM2
run: npm i -g pm2

server-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Install Doxygen
run: sudo apt-get install -y doxygen
- name: Build Project
run: npm run build
- name: Create .env file for sasjs/server
run: |
echo "RUN_TIMES=js" >> .env
echo "NODE_PATH=node" >> .env
echo "MOCK_SERVERTYPE=sas9" >> .env

- name: Download sasjs/server package
run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip -o linux.zip

- name: Unzip downloaded package
run: unzip linux.zip

- name: Run sasjs server
run: pm2 start api-linux

- name: Unzip and start server
run: |
unzip linux.zip
npx pm2 start api-linux
- name: Install sasjs CLI globally
run: |
npm version "5.0.0" --no-git-tag-version
npm pack
npm install -g ./sasjs-cli-5.0.0.tgz
- name: Deploy SAS9 tests
run: |
cd mocks
sasjs cbd
cd ..
ls sasjs_root -R

- name: Run server tests
run: npm run test:server
env:
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ module.exports = {
testMatch: ['**/*spec.[j|t]s?(x)'],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/build/', 'test-app-create-', 'test-app-init-'],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand Down
Loading