diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 8fb11f5a..a16ca6b3 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -1,6 +1,3 @@ -# 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: @@ -8,22 +5,21 @@ on: 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 @@ -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 }} diff --git a/.github/workflows/run-tests-windows.yml b/.github/workflows/run-tests-windows.yml index a9ead0db..717b7f82 100644 --- a/.github/workflows/run-tests-windows.yml +++ b/.github/workflows/run-tests-windows.yml @@ -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 @@ -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 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5757e432..cd63a222 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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: diff --git a/jest.config.js b/jest.config.js index 3d16ffbe..0d104abe 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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/', '/build/'], + testPathIgnorePatterns: ['/node_modules/', '/build/', 'test-app-create-', 'test-app-init-'], // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [],