From 4e018905fc6ad87e6f75f4fd31fe30a8e96d1699 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 15:17:47 -0700 Subject: [PATCH 1/9] Remove Chrome stuff (not needed for riot-web tests anymore) --- .buildkite/pipeline.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index a8ce1273fb..85aff94069 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -83,12 +83,6 @@ steps: # webpack loves to gorge itself on resources. queue: "medium" command: - # Install chrome - - "echo '--- Installing Chrome'" - - "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -" - - "sh -c 'echo \"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google.list'" - - "apt-get update" - - "apt-get install -y google-chrome-stable" # TODO: Remove hacky chmod for BuildKite - "chmod +x ./scripts/ci/*.sh" - "chmod +x ./scripts/*" @@ -98,8 +92,6 @@ steps: - "yarn build" - "echo '+++ Running Tests'" - "./scripts/ci/riot-unit-tests.sh" - env: - CHROME_BIN: "/usr/bin/google-chrome-stable" plugins: - docker#v3.0.1: image: "node:10" From 62b1dd77a68fdf5cee58fd0f9041a05e9155d0d7 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 16:12:59 -0700 Subject: [PATCH 2/9] Fix layering of the riot-web tests pipeline --- .buildkite/pipeline.yaml | 5 +---- scripts/ci/layered-riot-web.sh | 33 +++++++++++++++++++++++++++++++++ scripts/ci/riot-unit-tests.sh | 7 ++----- scripts/fetchdep.sh | 2 +- 4 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 scripts/ci/layered-riot-web.sh diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index 85aff94069..100d14e967 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -86,16 +86,13 @@ steps: # TODO: Remove hacky chmod for BuildKite - "chmod +x ./scripts/ci/*.sh" - "chmod +x ./scripts/*" - - "echo '--- Installing Dependencies'" - - "./scripts/ci/install-deps.sh" - - "echo '--- Running initial build steps'" - - "yarn build" - "echo '+++ Running Tests'" - "./scripts/ci/riot-unit-tests.sh" plugins: - docker#v3.0.1: image: "node:10" propagate-environment: true + workdir: "/workdir/matrix-react-sdk" - label: "🌐 i18n" command: diff --git a/scripts/ci/layered-riot-web.sh b/scripts/ci/layered-riot-web.sh new file mode 100644 index 0000000000..2b908be68f --- /dev/null +++ b/scripts/ci/layered-riot-web.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Creates an environment similar to one that riot-web would expect for +# development. This means going one directory up (and assuming we're in +# a directory like /workdir/matrix-react-sdk) and putting riot-web and +# the js-sdk there. + +cd ../ # Assume we're at something like /workdir/matrix-react-sdk + +# Set up the js-sdk first +matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-js-sdk +pushd matrix-js-sdk +yarn link +yarn install +#yarn build +popd + +# Now set up the react-sdk +pushd matrix-react-sdk +yarn link matrix-js-sdk +yarn link +yarn install +#yarn build +popd + +# Finally, set up riot-web +matrix-react-sdk/scripts/fetchdep.sh vector-im riot-web +pushd riot-web +yarn link matrix-js-sdk +yarn link matrix-react-sdk +yarn install +yarn build:res +popd diff --git a/scripts/ci/riot-unit-tests.sh b/scripts/ci/riot-unit-tests.sh index 215af13030..7a9ed77793 100755 --- a/scripts/ci/riot-unit-tests.sh +++ b/scripts/ci/riot-unit-tests.sh @@ -6,9 +6,6 @@ set -ev -RIOT_WEB_DIR=riot-web - -scripts/ci/build.sh -pushd "$RIOT_WEB_DIR" +scripts/ci/layered-riot-web.sh +cd ../riot-web yarn test -popd diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index f82752bfc5..f477fd08b8 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -17,7 +17,7 @@ clone() { if [ -n "$branch" ] then echo "Trying to use $org/$repo#$branch" - git clone git://github.com/$org/$repo.git $repo --branch "$branch" && exit 0 + git clone git://github.com/$org/$repo.git $repo --branch "$branch" --depth=1 && exit 0 fi } From 3eeeb9c6afbacf46da266675ff17772747a3a47f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 16:20:02 -0700 Subject: [PATCH 3/9] Remove irrelevant build steps --- scripts/ci/layered-riot-web.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/ci/layered-riot-web.sh b/scripts/ci/layered-riot-web.sh index 2b908be68f..f58794b451 100644 --- a/scripts/ci/layered-riot-web.sh +++ b/scripts/ci/layered-riot-web.sh @@ -12,7 +12,6 @@ matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-js-sdk pushd matrix-js-sdk yarn link yarn install -#yarn build popd # Now set up the react-sdk @@ -20,7 +19,6 @@ pushd matrix-react-sdk yarn link matrix-js-sdk yarn link yarn install -#yarn build popd # Finally, set up riot-web From 27412ba0b2f342a42652ae6da69d41cfc2a17b03 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 16:23:33 -0700 Subject: [PATCH 4/9] Fix end-to-end test layering too --- .buildkite/pipeline.yaml | 1 + scripts/ci/build.sh | 25 ------------------------- scripts/ci/end-to-end-tests.sh | 10 +++++----- 3 files changed, 6 insertions(+), 30 deletions(-) delete mode 100755 scripts/ci/build.sh diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index 100d14e967..de61d4e5b9 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -76,6 +76,7 @@ steps: - docker#v3.0.1: image: "matrixdotorg/riotweb-ci-e2etests-env:latest" propagate-environment: true + workdir: "/workdir/matrix-react-sdk" - label: "🔧 Riot Tests" agents: diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh deleted file mode 100755 index 0b1fa23093..0000000000 --- a/scripts/ci/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# script which is run by the CI build (after `yarn test`). -# -# clones riot-web develop and runs the tests against our version of react-sdk. - -set -ev - -RIOT_WEB_DIR=riot-web -REACT_SDK_DIR=`pwd` - -yarn link - -scripts/fetchdep.sh vector-im riot-web - -pushd "$RIOT_WEB_DIR" - -yarn link matrix-js-sdk -yarn link matrix-react-sdk - -yarn install - -yarn build - -popd diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index a592888292..9eb3c2bd87 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -21,15 +21,15 @@ handle_error() { trap 'handle_error' ERR -RIOT_WEB_DIR=riot-web -REACT_SDK_DIR=`pwd` - echo "--- Building Riot" -scripts/ci/build.sh +scripts/ci/layered-riot-web.sh +cd ../riot-web +yarn build +cd ../matrix-react-sdk # run end to end tests pushd test/end-to-end-tests -ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web +ln -s ../riot-web riot/riot-web # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh # CHROME_PATH=$(which google-chrome-stable) ./run.sh echo "--- Install synapse & other dependencies" From 19615d372175e6f7e8f7756e33f236ac41cb626e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 16:33:13 -0700 Subject: [PATCH 5/9] Disable minification of Riot in end-to-end tests --- scripts/ci/end-to-end-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index 9eb3c2bd87..cc1e548af9 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -25,7 +25,7 @@ trap 'handle_error' ERR echo "--- Building Riot" scripts/ci/layered-riot-web.sh cd ../riot-web -yarn build +CI_PACKAGE=true yarn build cd ../matrix-react-sdk # run end to end tests pushd test/end-to-end-tests From 776b3af6bb46c7a55a121abfffe32dc26efcf772 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 16:33:22 -0700 Subject: [PATCH 6/9] Fix relative pathing on riot-web link --- scripts/ci/end-to-end-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index cc1e548af9..bae268bbe3 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -29,7 +29,7 @@ CI_PACKAGE=true yarn build cd ../matrix-react-sdk # run end to end tests pushd test/end-to-end-tests -ln -s ../riot-web riot/riot-web +ln -s ../../../riot-web riot/riot-web # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh # CHROME_PATH=$(which google-chrome-stable) ./run.sh echo "--- Install synapse & other dependencies" From 3b2f96bc047bbe221efe216ced07dc927d016d09 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 20 Jan 2020 18:02:54 -0700 Subject: [PATCH 7/9] Try explicitly mapping the directory --- scripts/ci/end-to-end-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index bae268bbe3..9bdb512940 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -25,11 +25,12 @@ trap 'handle_error' ERR echo "--- Building Riot" scripts/ci/layered-riot-web.sh cd ../riot-web +riot_web_dir=`pwd` CI_PACKAGE=true yarn build cd ../matrix-react-sdk # run end to end tests pushd test/end-to-end-tests -ln -s ../../../riot-web riot/riot-web +ln -s $riot_web_dir riot/riot-web # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh # CHROME_PATH=$(which google-chrome-stable) ./run.sh echo "--- Install synapse & other dependencies" From 33220c2d7230c999b0f65158a66affdd87e756a1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 21 Jan 2020 10:53:17 -0700 Subject: [PATCH 8/9] Ensure generated files are present for riot-web tests --- scripts/ci/riot-unit-tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/riot-unit-tests.sh b/scripts/ci/riot-unit-tests.sh index 7a9ed77793..337c0fe6c3 100755 --- a/scripts/ci/riot-unit-tests.sh +++ b/scripts/ci/riot-unit-tests.sh @@ -8,4 +8,5 @@ set -ev scripts/ci/layered-riot-web.sh cd ../riot-web +yarn build:genfiles # so the tests can run. Faster version of `build` yarn test From 708f62784fbf7c46e2105e255faa28f6d1fd5879 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 21 Jan 2020 10:59:33 -0700 Subject: [PATCH 9/9] Consistency Co-Authored-By: J. Ryan Stinnett --- scripts/fetchdep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index f477fd08b8..0142305797 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -17,7 +17,7 @@ clone() { if [ -n "$branch" ] then echo "Trying to use $org/$repo#$branch" - git clone git://github.com/$org/$repo.git $repo --branch "$branch" --depth=1 && exit 0 + git clone git://github.com/$org/$repo.git $repo --branch "$branch" --depth 1 && exit 0 fi }