From c5ae0def4234e1869229b56cdb190d732fba60fc Mon Sep 17 00:00:00 2001 From: Vladislav Leonkev Date: Mon, 19 Feb 2024 15:48:12 +0100 Subject: [PATCH] try out cached ui5 tgz --- .../gettingStarted.cached.ui5.tgz.yml | 53 +++++++++++++++ ...estGettingStartedReuseUI5LocalBuild.tgz.sh | 65 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 .github/workflows/gettingStarted.cached.ui5.tgz.yml create mode 100755 test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh diff --git a/.github/workflows/gettingStarted.cached.ui5.tgz.yml b/.github/workflows/gettingStarted.cached.ui5.tgz.yml new file mode 100644 index 0000000..c3e8f85 --- /dev/null +++ b/.github/workflows/gettingStarted.cached.ui5.tgz.yml @@ -0,0 +1,53 @@ +name: getting-started-cached-ui5-tgz +on: + push: + branches: [ "run-github-actions-cached-ui5-tgz" ] +jobs: + getting-started-cached-ui5-tgz: + name: getting-started-cached-ui5-tgz + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [ 18 ] + sap-ui5-version: [ 1.120.6 ] + steps: + - uses: actions/checkout@v3 + + - uses: actions/cache/restore@v3 + id: cache + with: + path: tmp/sapui5/sapui5-${{ matrix.sap-ui5-version }}.tgz + key: sapui5-${{ matrix.sap-ui5-version }}-tgz + + - name: Build UI5 + if: steps.cache.outputs.cache-hit != 'true' + env: + SAP_UI5_VERSION: ${{ matrix.sap-ui5-version }} + run: ./test/bin/build.ui5.tgz.sh + + - uses: actions/cache/save@v3 + if: steps.cache.outputs.cache-hit != 'true' + with: + path: tmp/sapui5/sapui5-${{ matrix.sap-ui5-version }}.tgz + key: sapui5-${{ matrix.sap-ui5-version }}-tgz + + - name: list cache + run: ls -altr tmp/sapui5/sapui5-${{ matrix.sap-ui5-version }}.tgz + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: prepare + run: npm ci + + - name: selenium + run: docker run -d -p 4444:4444 --network host selenium/standalone-chrome + + - name: test + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + SAP_UI5_VERSION: ${{ matrix.sap-ui5-version }} + run: | + SELENIUM_REMOTE_URL="http://127.0.0.1:4444/wd/hub" bash ./test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh diff --git a/test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh b/test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh new file mode 100755 index 0000000..21dee35 --- /dev/null +++ b/test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +set -e +set -x + +. ./test/bin/.sapui5.version.sh + +ROOT_DIR=`pwd` +DIR=tmp/getting-started-locally-reuse-local-ui5-tgz + +#test -d $DIR && rm -r -f $DIR +test -d ${DIR} || mkdir -p $DIR +cd $DIR +test -f package.json || npm init -y +test -d dk || npm init -w dk -y +test -d node_modules/@sap/cds-dk || npm add -w dk @sap/cds-dk + +if [ -d "service" ]; then + echo "Service already generated." + cd service +else + npm init -w service -y + rm service/package.json + cd service + + npx cds init --add sample + if [ "$BRANCH_NAME" == "" ]; then + npm add ../../.. || true + else + npm add -D git+https://github.com/cap-js-community/cds-cucumber.git#$BRANCH_NAME + fi +fi + +if [ -f "cucumber.yml" ]; then + echo "Cucumber already enabled." +else +npx cds-add-cucumber + +if [ "$BRANCH_NAME" == "" ]; then +# requireModule does not work with links -> require the steps directly +cat <cucumber.yml +default: + require: + - ../../../lib/index.js +EOF +fi + +fi + +. ${ROOT_DIR}/test/bin/.sapui5.tgz.sh +if [ -f "${SAPUI5_ARCHIVE_FILE}" ]; then + echo "Found UI5 local tgz build: ${SAPUI5_ARCHIVE_FILE}" +else + echo "Could not find UI5 local tgz build" + exit 1 +fi + +if [ -d "../local-ui5-tgz-plugin" ]; then + echo "Plugin local-ui5-build already installed." +else + npx cds-add-cucumber-plugin -p local-ui5-tgz -f app/index.html +fi + +cp test/features/bookshop.feature test/features/bookshop1.feature +npx cucumber-js test --parallel 2