diff --git a/.github/actions/integration-tests/action.yml b/.github/actions/integration-tests/action.yml index 54b17bd..5611f64 100644 --- a/.github/actions/integration-tests/action.yml +++ b/.github/actions/integration-tests/action.yml @@ -48,16 +48,36 @@ runs: done - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - - run: npm i -g @sap/cds-dk + + - name: Set CDS version-specific dependencies shell: bash - - run: npm i + run: | + if [ "${{ matrix.cds-version }}" == "8" ]; then + echo "Installing CDS 8 compatible packages..." + npm pkg set "devDependencies.@cap-js/sqlite=^1.0.0" + npm pkg set "overrides.@cap-js/sqlite=^1.0.0" + npm pkg set "overrides.@cap-js/hana=^1.0.0" + npm pkg set "overrides.@cap-js/db-service=^1.0.0" + cd test/incidents-app + npm pkg set "dependencies.@cap-js/hana=^1.0.0" + npm pkg set "dependencies.@cap-js/db-service=^1.0.0" + cd ../.. + fi + + - name: Install global CDS shell: bash - - run: cd test/incidents-app && npm i + run: npm i -g @sap/cds-dk@${{ matrix.cds-version }} + + - name: Install root dependencies shell: bash + run: | + npm install @sap/cds@${{ matrix.cds-version }} + npm install - name: Set node env for HANA run: echo "NODE_VERSION_HANA=$(echo ${{ inputs.NODE_VERSION }} | tr . _)" >> $GITHUB_ENV @@ -65,13 +85,13 @@ runs: # Deploy model to HANA - name: Create HDI Container shell: bash - run: cf create-service hana hdi-shared cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA - - run: cd test/incidents-app/ && cds deploy --to hana:cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA + run: cf create-service hana hdi-shared cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }} + - run: cd test/incidents-app/ && cds deploy --to hana:cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }} shell: bash # Bind against BTP services - - run: cds bind db -2 cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA -o package.json + - run: cds bind db -2 cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }} -o package.json shell: bash - - run: cds bind -2 print-service -o package.json + - run: cds bind print-service -2 print-service -o package.json shell: bash # Run tests in hybrid mode - run: cds bind --exec npm run test @@ -80,7 +100,7 @@ runs: # Cleanup - name: Delete HDI Container Key if: ${{ always() }} - run: cf delete-service-key cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-key -f + run: cf delete-service-key cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }} cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }}-key -f shell: bash # Somehow first delete always fails with a "ongoing operation on service binding" error - name: Delete HDI Container @@ -88,7 +108,7 @@ runs: shell: bash run: | for i in {1..3}; do - cf delete-service cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA -f && break + cf delete-service cap-js-print-hana-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-$NODE_VERSION_HANA-${{ matrix.cds-version }} -f && break echo "HDI container delete failed, retrying ($i/3)..." sleep 10 if [ "$i" -eq 3 ]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b47df72..0e6cbd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: run: | npm install npm run lint - cd tests/incidents-app && npm install + cd test/incidents-app && npm install cd ../.. npm run test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 069875f..48eed21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: node-version: [20.x, 22.x] - cds-version: [latest] + cds-version: [latest, 8] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -31,6 +31,7 @@ jobs: fail-fast: false matrix: node-version: [20.x, 22.x] + cds-version: [latest, 8] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 695ac39..b11f7d6 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ mta_archives/ # @cap-js/cds-typer @cds-models + +package-lock.json diff --git a/jest.config.js b/jest.config.js index a971655..2f69ac6 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ const config = { - testTimeout: 60000, + testTimeout: 120000, testMatch: ["**/*.test.js"], forceExit: true, detectOpenHandles: true, diff --git a/package.json b/package.json index eb72bfb..b117d45 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,15 @@ "@sap/xssec": "^3.6.2" }, "peerDependencies": { - "@sap/cds": ">=9" + "@sap/cds": ">= 8" }, "devDependencies": { "@cap-js/cds-test": "^0.2.0", "@cap-js/sqlite": "^2" }, + "workspaces": [ + "test/incidents-app/" + ], "cds": { "requires": { "destinations": true, @@ -69,8 +72,5 @@ "prettier:check": "npx -y prettier@3 --check .", "watch-sample": "cd test/incidents-app && cds watch", "watch-sample:hybrid": "cd test/incidents-app && cds watch --profile hybrid" - }, - "workspaces": [ - "test/incidents-app/" - ] + } } diff --git a/test/incidents-app/package.json b/test/incidents-app/package.json index c9958dd..70fe536 100644 --- a/test/incidents-app/package.json +++ b/test/incidents-app/package.json @@ -2,7 +2,8 @@ "name": "@capire/incidents", "version": "1.0.0", "dependencies": { - "@cap-js/hana": "*", + "@cap-js/hana": "^2.0.0", + "@cap-js/db-service": "^2.0.0", "@cap-js/print": "file:../../." }, "scripts": {