diff --git a/.github/workflows/build-unit-tests.yml b/.github/workflows/build-unit-tests.yml new file mode 100644 index 0000000..1efdf42 --- /dev/null +++ b/.github/workflows/build-unit-tests.yml @@ -0,0 +1,49 @@ +# 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: SASjs Build and Unit Test + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-22.04 + + strategy: + matrix: + node-version: [lts/hydrogen] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: npm + + - name: Check npm audit + run: npm audit --production --audit-level=low + + - name: Install Dependencies + run: npm ci + + - name: Install Rimraf + run: npm i rimraf + + - name: Check code style + run: npm run lint + + - name: Run unit tests + run: npm test + + - name: Build Package + run: npm run package:lib + env: + CI: true + + # For some reason if coverage report action is run before other commands, those commands can't access the directories and files on which they depend on + - name: Generate coverage report + uses: artiomtr/jest-coverage-report-action@v2.0-rc.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/server-tests.yml similarity index 85% rename from .github/workflows/build.yml rename to .github/workflows/server-tests.yml index e4e08e8..d130160 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/server-tests.yml @@ -1,7 +1,7 @@ # 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: SASjs Build +name: SASjs Build and Server Tests on: pull_request: @@ -22,22 +22,12 @@ jobs: node-version: ${{ matrix.node-version }} cache: npm - # FIXME: uncomment 'Check npm audit' step after axios version bump - # - name: Check npm audit - # run: npm audit --production --audit-level=low - - name: Install Dependencies run: npm ci - name: Install Rimraf run: npm i rimraf - - name: Check code style - run: npm run lint - - - name: Run unit tests - run: npm test - - name: Build Package run: npm run package:lib env: @@ -106,9 +96,3 @@ jobs: echo "SASJS_USERNAME=${{ secrets.SASJS_USERNAME }}" sh ./sasjs-tests/sasjs-cypress-run.sh ${{ secrets.MATRIX_TOKEN }} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - - # For some reason if coverage report action is run before other commands, those commands can't access the directories and files on which they depend on - - name: Generate coverage report - uses: artiomtr/jest-coverage-report-action@v2.0-rc.2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 7151d4d..020a51d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "hasInstallScript": true, "license": "ISC", "dependencies": { - "@sasjs/utils": "^3.5.1", + "@sasjs/utils": "3.5.2", "axios": "1.8.1", "axios-cookiejar-support": "5.0.5", "form-data": "4.0.0", @@ -2425,6 +2425,8 @@ }, "node_modules/@sasjs/utils": { "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-3.5.2.tgz", + "integrity": "sha512-LBpBDx0T7G/eO15Gb+r3DR1LfBnoqagWT3HiHabojFziA4ej4ePORo8chrk0zHLIzrjI2ljAnDabyJEwC5KtIA==", "hasInstallScript": true, "license": "ISC", "dependencies": { @@ -2799,6 +2801,8 @@ }, "node_modules/@types/fs-extra": { "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", "license": "MIT", "dependencies": { "@types/jsonfile": "*", @@ -2877,6 +2881,8 @@ }, "node_modules/@types/jsonfile": { "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", "license": "MIT", "dependencies": { "@types/node": "*" diff --git a/package.json b/package.json index cddc86a..7d103a8 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "main": "index.js", "dependencies": { - "@sasjs/utils": "^3.5.1", + "@sasjs/utils": "3.5.2", "axios": "1.8.1", "axios-cookiejar-support": "5.0.5", "form-data": "4.0.0",