Skip to content

Commit

Permalink
try out cached ui5 tgz
Browse files Browse the repository at this point in the history
  • Loading branch information
vl-leon committed Feb 19, 2024
1 parent 6930018 commit ff71b96
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/gettingStarted.cached.ui5.tgz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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
65 changes: 65 additions & 0 deletions test/bin/testGettingStartedReuseUI5LocalBuild.tgz.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF >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

0 comments on commit ff71b96

Please sign in to comment.