From 9251e262b7e3d4769f07a6599849cdd2f1a9bb30 Mon Sep 17 00:00:00 2001 From: Lovisa Berggren Date: Mon, 16 Dec 2024 15:21:01 +0000 Subject: [PATCH 1/4] CLOUDP-290332: Run IPA validation and Jest tests as workflow --- .github/workflows/code-health-tools.yml | 19 +++++++++++++++++++ .github/workflows/spectral-lint.yml | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/code-health-tools.yml b/.github/workflows/code-health-tools.yml index d8ce90377c..7435293b9f 100644 --- a/.github/workflows/code-health-tools.yml +++ b/.github/workflows/code-health-tools.yml @@ -46,6 +46,25 @@ jobs: - name: Run unit tests working-directory: tools/cli run: make unit-test + js-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + sparse-checkout: | + .github + tools + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + - name: Install npm dependencies + run: npm install + - name: Run Jest tests + run: | + npm run test lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/spectral-lint.yml b/.github/workflows/spectral-lint.yml index ad84f46374..e7b5b3faeb 100644 --- a/.github/workflows/spectral-lint.yml +++ b/.github/workflows/spectral-lint.yml @@ -7,6 +7,7 @@ on: - 'tools/spectral/**' - 'openapi/**.yaml' - '.spectral.yaml' + - 'ipa-spectral.yaml' push: branches: - main @@ -14,6 +15,7 @@ on: - 'tools/spectral/**' - 'openapi/**.yaml' - '.spectral.yaml' + - 'ipa-spectral.yaml' jobs: spectral-lint: @@ -33,3 +35,8 @@ jobs: # Path to the OpenAPI spec files and openapi/v2.yaml file_glob: openapi/v2.yaml spectral_ruleset: tools/spectral/.spectral.yaml #If updated, need to update in MMS too. + - name: IPA validation action + uses: stoplightio/spectral-action@2ad0b9302e32a77c1caccf474a9b2191a8060d83 + with: + file_glob: openapi/v2.yaml + spectral_ruleset: tools/spectral/ipa/ipa-spectral.yaml From 4527bacbcdbd719b8380a1e444a1db746eda849c Mon Sep 17 00:00:00 2001 From: Lovisa Berggren Date: Mon, 16 Dec 2024 15:22:01 +0000 Subject: [PATCH 2/4] CLOUDP-290332: Test should run and fail --- tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js b/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js index 9ca9913787..c7a14cf916 100644 --- a/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js +++ b/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js @@ -59,6 +59,9 @@ describe('tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js', () it('returns false for a nested singleton resource', () => { expect(isStandardResource(nestedSingletonResourcePaths)).toBe(false); }); + it('testing that this test fails', () => { + expect(isStandardResource(nestedSingletonResourcePaths)).toBe(true); + }); }); describe('isSingletonResource', () => { it('returns true for a singleton resource', () => { From 5c6c6ca305a5ccdb4b36aee8047e1b7ae978ea04 Mon Sep 17 00:00:00 2001 From: Lovisa Berggren Date: Mon, 16 Dec 2024 15:46:47 +0000 Subject: [PATCH 3/4] Revert "CLOUDP-290332: Test should run and fail" This reverts commit 4527bacbcdbd719b8380a1e444a1db746eda849c. --- tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js b/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js index c7a14cf916..9ca9913787 100644 --- a/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js +++ b/tools/spectral/ipa/__tests__/utils/resourceEvaluation.test.js @@ -59,9 +59,6 @@ describe('tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js', () it('returns false for a nested singleton resource', () => { expect(isStandardResource(nestedSingletonResourcePaths)).toBe(false); }); - it('testing that this test fails', () => { - expect(isStandardResource(nestedSingletonResourcePaths)).toBe(true); - }); }); describe('isSingletonResource', () => { it('returns true for a singleton resource', () => { From a43905b2e9fbe6f9365e24ea76adb6f3d10ae102 Mon Sep 17 00:00:00 2001 From: Lovisa Berggren Date: Mon, 16 Dec 2024 16:27:50 +0000 Subject: [PATCH 4/4] CLOUDP-290332: Update sparse checkout --- .github/workflows/code-health-tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-health-tools.yml b/.github/workflows/code-health-tools.yml index 7435293b9f..b2a7249be7 100644 --- a/.github/workflows/code-health-tools.yml +++ b/.github/workflows/code-health-tools.yml @@ -54,7 +54,7 @@ jobs: with: sparse-checkout: | .github - tools + tools/spectral/ipa - name: Setup Node uses: actions/setup-node@v4 with: