From 50c4888b99e0074a82f8c35f033ddc2b1f6fa639 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 27 Mar 2019 14:58:34 -0700 Subject: [PATCH 1/6] Run headless browser tests in CI --- .azure-pipelines.yml | 28 +++++++++++++++++++++++++--- .ci/install-wasm-pack.yml | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .ci/install-wasm-pack.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 4893d187..d057149d 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -1,7 +1,8 @@ pr: ["master"] jobs: - - job: + - job: test_all_native + displayName: "Native Tests" pool: vmImage: 'ubuntu-16.04' steps: @@ -10,6 +11,27 @@ jobs: rust_version: stable - bash: | export RUST_BACKTRACE=1 - cargo check --all || exit cargo test --all || exit - displayName: Run cargo check and test + displayName: Run cargo check and test + - job: test_headless_firefox + displayName: "Headless Browser Tests (Firefox)" + steps: + - template: .ci/install-rust.yml + - template: .ci/install-wasm-pack.yml + - displayName: "Run `wasm-pack test`" + script: | + for x in $(ls crates); do + wasm-pack test --headless --firefox crates/$x -- --all-features || exit 1 + wasm-pack test --headless --firefox crates/$x -- --no-default-features || exit 1 + done + - job: test_headless_chrome + displayName: "Headless Browser Tests (Chrome)" + steps: + - template: .ci/install-rust.yml + - template: .ci/install-wasm-pack.yml + - displayName: "Run `wasm-pack test`" + script: | + for x in $(ls crates); do + wasm-pack test --headless --chrome crates/$x -- --all-features || exit 1 + wasm-pack test --headless --chrome crates/$x -- --no-default-features || exit 1 + done diff --git a/.ci/install-wasm-pack.yml b/.ci/install-wasm-pack.yml new file mode 100644 index 00000000..883b5bde --- /dev/null +++ b/.ci/install-wasm-pack.yml @@ -0,0 +1,3 @@ +- steps: + - displayName: "Install `wasm-pack`" + script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f From ad772f9abc6f66301a61ae657e700f3fb73a705d Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 Mar 2019 13:50:19 -0700 Subject: [PATCH 2/6] CI: Make sure displayName comes after the script --- .azure-pipelines.yml | 8 ++++---- .ci/install-wasm-pack.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index d057149d..96265d20 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -18,20 +18,20 @@ jobs: steps: - template: .ci/install-rust.yml - template: .ci/install-wasm-pack.yml - - displayName: "Run `wasm-pack test`" - script: | + - script: | for x in $(ls crates); do wasm-pack test --headless --firefox crates/$x -- --all-features || exit 1 wasm-pack test --headless --firefox crates/$x -- --no-default-features || exit 1 done + displayName: "Run `wasm-pack test`" - job: test_headless_chrome displayName: "Headless Browser Tests (Chrome)" steps: - template: .ci/install-rust.yml - template: .ci/install-wasm-pack.yml - - displayName: "Run `wasm-pack test`" - script: | + - script: | for x in $(ls crates); do wasm-pack test --headless --chrome crates/$x -- --all-features || exit 1 wasm-pack test --headless --chrome crates/$x -- --no-default-features || exit 1 done + displayName: "Run `wasm-pack test`" diff --git a/.ci/install-wasm-pack.yml b/.ci/install-wasm-pack.yml index 883b5bde..3830148b 100644 --- a/.ci/install-wasm-pack.yml +++ b/.ci/install-wasm-pack.yml @@ -1,3 +1,3 @@ - steps: - - displayName: "Install `wasm-pack`" - script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + - script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + displayName: "Install `wasm-pack`" From b5565c8f67447a71c7555b42360f9599d79f5adc Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 Mar 2019 13:52:20 -0700 Subject: [PATCH 3/6] CI: fix indentation of install-wasm-pack.yml template --- .ci/install-wasm-pack.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/install-wasm-pack.yml b/.ci/install-wasm-pack.yml index 3830148b..37942464 100644 --- a/.ci/install-wasm-pack.yml +++ b/.ci/install-wasm-pack.yml @@ -1,3 +1,3 @@ - steps: - - script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - displayName: "Install `wasm-pack`" + - script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + displayName: "Install `wasm-pack`" From 3bc47d5e7c45b7317e003d645163064424ac7ab8 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 Mar 2019 13:54:52 -0700 Subject: [PATCH 4/6] Fix CI... --- .ci/install-wasm-pack.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/install-wasm-pack.yml b/.ci/install-wasm-pack.yml index 37942464..5d142c66 100644 --- a/.ci/install-wasm-pack.yml +++ b/.ci/install-wasm-pack.yml @@ -1,3 +1,5 @@ - steps: - - script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + - script: "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f" displayName: "Install `wasm-pack`" + - script: "wasm-pack --version" + displayName: "Query `wasm-pack` version" From 3f7f934fc77196e19137a018e9e1f2dd20dd0a3f Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 Mar 2019 13:55:42 -0700 Subject: [PATCH 5/6] CI: Template should use `step:` not `- steps:` --- .ci/install-wasm-pack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/install-wasm-pack.yml b/.ci/install-wasm-pack.yml index 5d142c66..2f530081 100644 --- a/.ci/install-wasm-pack.yml +++ b/.ci/install-wasm-pack.yml @@ -1,4 +1,4 @@ -- steps: +steps: - script: "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f" displayName: "Install `wasm-pack`" - script: "wasm-pack --version" From 9743a7afe05ff24039d6e21147a5fd72b1b22b38 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 28 Mar 2019 14:01:00 -0700 Subject: [PATCH 6/6] CI: De-duplicate `wasm-pack test` script --- .azure-pipelines.yml | 22 ++++++++++------------ .ci/wasm-pack-test-headless.yml | 10 ++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .ci/wasm-pack-test-headless.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 96265d20..30b1ab77 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -17,21 +17,19 @@ jobs: displayName: "Headless Browser Tests (Firefox)" steps: - template: .ci/install-rust.yml + parameters: + rust_version: stable - template: .ci/install-wasm-pack.yml - - script: | - for x in $(ls crates); do - wasm-pack test --headless --firefox crates/$x -- --all-features || exit 1 - wasm-pack test --headless --firefox crates/$x -- --no-default-features || exit 1 - done - displayName: "Run `wasm-pack test`" + - template: .ci/wasm-pack-test-headless.yml + parameters: + browser_flag: --firefox - job: test_headless_chrome displayName: "Headless Browser Tests (Chrome)" steps: - template: .ci/install-rust.yml + parameters: + rust_version: stable - template: .ci/install-wasm-pack.yml - - script: | - for x in $(ls crates); do - wasm-pack test --headless --chrome crates/$x -- --all-features || exit 1 - wasm-pack test --headless --chrome crates/$x -- --no-default-features || exit 1 - done - displayName: "Run `wasm-pack test`" + - template: .ci/wasm-pack-test-headless.yml + parameters: + browser_flag: --chrome diff --git a/.ci/wasm-pack-test-headless.yml b/.ci/wasm-pack-test-headless.yml new file mode 100644 index 00000000..0b38f02c --- /dev/null +++ b/.ci/wasm-pack-test-headless.yml @@ -0,0 +1,10 @@ +steps: + - script: | + set -ex + for x in $(ls crates); do + wasm-pack test --headless $BROWSER_FLAG crates/$x -- --all-features + wasm-pack test --headless $BROWSER_FLAG crates/$x -- --no-default-features + done + env: + BROWSER_FLAG: ${{parameters.browser_flag}} + displayName: Run `wasm-pack test`