From 6009caa205abfd9669a328b313364f3ce698cb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dani=C5=82o?= Date: Mon, 16 Mar 2020 11:16:16 +0100 Subject: [PATCH] Making tests on CI faster by running them in parallel (https://github.com/enso-org/ide/pull/264) Original commit: https://github.com/enso-org/ide/commit/44df1d67069486328ed46ef0ac2021c125e1a8c8 --- gui/.github/workflows/build.yml | 39 +++++++++++++++++++++++++++------ gui/build/run.js | 29 ++++++++++++++++++------ gui/src/rust/Cargo.toml | 2 +- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/gui/.github/workflows/build.yml b/gui/.github/workflows/build.yml index 9ff1000a4c..b32f2a76ca 100644 --- a/gui/.github/workflows/build.yml +++ b/gui/.github/workflows/build.yml @@ -10,6 +10,7 @@ jobs: build: name: Build + if: github.event_name == 'push' && github.ref == 'refs/heads/master' runs-on: ${{ matrix.os }} strategy: matrix: @@ -81,8 +82,8 @@ jobs: path: dist/client/mac/Enso Studio.app - lint: - name: Lint + check: + name: Check runs-on: ${{ matrix.os }} strategy: matrix: @@ -110,10 +111,7 @@ jobs: test: name: Tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest,macOS-latest,ubuntu-latest] + runs-on: macOS-latest steps: - uses: actions/checkout@v1 @@ -135,7 +133,34 @@ jobs: node-version: '12.16.1' - name: Run tests - run: node ./run test + run: node ./run test --no-wasm + + + wasm-test: + name: WASM Tests + runs-on: macOS-latest + steps: + - uses: actions/checkout@v1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2019-11-04 + override: true + + - name: Install wasm-pack + uses: actions-rs/cargo@v1 + with: + command: install + args: wasm-pack --version 0.8.1 + + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: '12.16.1' + + - name: Run tests + run: node ./run test --no-native # TODO: enable after fixing https://github.com/actions-rs/grcov/issues/50 diff --git a/gui/build/run.js b/gui/build/run.js index 9dc04329ac..4ade78ec77 100755 --- a/gui/build/run.js +++ b/gui/build/run.js @@ -165,13 +165,17 @@ commands.start.js = async function() { // === Test === commands.test = command(`Run test suites`) -commands.test.rust = async function() { - console.log(`Running Rust test suite.`) - await run('cargo',['test']) +commands.test.rust = async function(argv) { + if (argv.native) { + console.log(`Running Rust test suite.`) + await run('cargo',['test']) + } - console.log(`Running Rust visual test suite.`) - let args = ['run','--manifest-path=test/Cargo.toml','--bin','test_all','--','--headless','--chrome'] - await run('cargo',args) + if (argv.wasm) { + console.log(`Running Rust WASM test suite.`) + let args = ['run','--manifest-path=test/Cargo.toml','--bin','test_all','--','--headless','--chrome'] + await run('cargo',args) + } } @@ -261,7 +265,18 @@ let commandList = Object.keys(commands) commandList.sort() for (let command of commandList) { let config = commands[command] - optParser.command(command,config.docs) + optParser.command(command,config.docs,(args) => { + args.options('native', { + describe : 'Run native tests', + type : 'bool', + default : true + }) + args.options('wasm', { + describe : 'Run WASM tests', + type : 'bool', + default : true + }) + }) } diff --git a/gui/src/rust/Cargo.toml b/gui/src/rust/Cargo.toml index 48ba516200..6ab4781169 100644 --- a/gui/src/rust/Cargo.toml +++ b/gui/src/rust/Cargo.toml @@ -29,7 +29,7 @@ members = [ ] [profile.dev] -opt-level = 2 +opt-level = 0 lto = false debug = true