Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow with cached ui5 tgz #188

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/gettingStarted.cached.ui5.tgz.yml
Original file line number Diff line number Diff line change
@@ -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
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
Loading