Skip to content

Commit 4f214af

Browse files
committed
Unify test scripts
1 parent 23466da commit 4f214af

File tree

3 files changed

+27
-37
lines changed

3 files changed

+27
-37
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@ jobs:
4646
include:
4747
- lens-ref: HEAD
4848
node-version: 16
49-
script: tools/integration_test.sh
5049
- lens-ref: v6.4.7
5150
node-version: 16
52-
script: tools/integration_test.sh
5351
- lens-ref: v6.3.0
5452
node-version: 16
55-
script: tools/integration_test_pre6.4.0.sh
5653
steps:
5754
- name: Check out repository
5855
uses: actions/checkout@v3
@@ -75,4 +72,4 @@ jobs:
7572

7673
- name: Run integration test
7774
run: |-
78-
EXTENSION_PATH="$(realpath out/$(ls -1 out))" LENS_REF="${{ matrix.lens-ref }}" xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' ${{ matrix.script }}
75+
EXTENSION_PATH="$(realpath out/$(ls -1 out))" LENS_REF="${{ matrix.lens-ref }}" xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' tools/integration_test.sh

tools/integration_test.sh

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,36 @@ set -exo pipefail
44

55
[ -z "${EXTENSION_PATH}" ] && echo "EXTENSION_PATH environment variable must be set" && exit 1
66

7-
DIR=$(mktemp -d)
8-
git clone https://github.com/lensapp/lens ${DIR}/lens
9-
[ ! -z "${LENS_REF}" ] && git -C ${DIR}/lens checkout ${LENS_REF}
10-
cp tools/extensions.tests.ts ${DIR}/lens/packages/open-lens/integration/__tests__/extensions.tests.ts
11-
TARGET_FILE="${DIR}/lens/packages/open-lens/package.json" node tools/remove_extra_lens_targets.js
12-
13-
pushd ${DIR}/lens
14-
if [ -f "package-lock.json" ]; then
15-
npm ci
7+
TEST_TMPDIR=$(mktemp -d)
8+
git clone https://github.com/lensapp/lens ${TEST_TMPDIR}/lens
9+
[ ! -z "${LENS_REF}" ] && git -C ${TEST_TMPDIR}/lens checkout ${LENS_REF}
10+
11+
if [ -d "${TEST_TMPDIR}/lens/packages/open-lens" ]; then
12+
OPENLENS_ROOT_DIR="${TEST_TMPDIR}/lens/packages/open-lens"
13+
else
14+
OPENLENS_ROOT_DIR="${TEST_TMPDIR}/lens"
15+
fi
16+
17+
cp tools/extensions.tests.ts "${OPENLENS_ROOT_DIR}/integration/__tests__/extensions.tests.ts"
18+
TARGET_FILE="${OPENLENS_ROOT_DIR}/package.json" node tools/remove_extra_lens_targets.js
19+
20+
pushd ${TEST_TMPDIR}/lens
21+
if [ -f "Makefile" ]; then
22+
make build
1623
else
17-
npm install
18-
fi
24+
if [ -f "package-lock.json" ]; then
25+
npm ci
26+
else
27+
npm install
28+
fi
1929

20-
npm run build:app
30+
npm run build:app
31+
fi
2132

2233
# If left present, the snap package will be mistaken for an obsolete Jest snapshot
23-
rm -f packages/open-lens/dist/*.snap
34+
rm -f ${OPENLENS_ROOT_DIR}/dist/*.snap
2435

25-
cd packages/open-lens && npx jest --forceExit -- integration/__tests__/extensions.tests.ts
36+
cd ${OPENLENS_ROOT_DIR} && npx jest --forceExit -- integration/__tests__/extensions.tests.ts
2637
popd
2738

28-
rm -rf ${DIR}
39+
rm -rf ${TEST_TMPDIR}

tools/integration_test_pre6.4.0.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)