Skip to content

Commit

Permalink
Merge pull request #17626 from hashicorp/f/ui-test-splitting
Browse files Browse the repository at this point in the history
[UI, CI] Test splitting
  • Loading branch information
DingoEatingFuzz authored and lgfa29 committed Jun 22, 2023
1 parent 8f3f8c7 commit 51ed353
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 36 deletions.
60 changes: 51 additions & 9 deletions .github/workflows/test-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,64 @@ on:
- 'website/**'

jobs:
test-ui:
pre-test:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ui
outputs:
nonce: ${{ steps.nonce.outputs.nonce }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install
run: cd ui && yarn install --frozen-lockfile
run: yarn install --frozen-lockfile
- name: lint:js
run: cd ui && yarn run lint:js
run: yarn run lint:js
- name: lint:hbs
run: cd ui && yarn run lint:hbs
- name: Ember tests
run: yarn run lint:hbs
- id: nonce
name: nonce
run: echo "nonce=${{ github.run_id }}-$(date +%s)" >> "$GITHUB_OUTPUT"

tests:
needs:
- pre-test
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ui
strategy:
matrix:
partition: [1, 2, 3, 4]
split: [4]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install
run: yarn install --frozen-lockfile
- name: ember exam
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.pre-test.outputs.nonce }}
run: yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }}
finalize:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ui
needs:
- pre-test
- tests
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install
run: yarn install --frozen-lockfile
- name: finalize
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: mkdir -p /tmp/test-reports && cd ui && yarn exam
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
path: "/tmp/test-reports"
PERCY_PARALLEL_NONCE: ${{ needs.pre-test.outputs.nonce }}
run: yarn percy build:finalize
permissions:
contents: read
4 changes: 3 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"build-storybook": "STORYBOOK=true ember build && build-storybook -s dist",
"storybook": "STORYBOOK=true start-storybook -p 6006 -s dist",
"test": "npm-run-all lint test:*",
"exam": "ember exam --split=4 --parallel",
"exam": "percy exec -- ember exam --split=4 --parallel",
"exam:parallel": "percy exec --parallel -- ember exam",
"percy": "percy",
"test:ember": "percy exec -- ember test",
"local:qunitdom": "ember test --server --query=dockcontainer",
"local:exam": "ember exam --server --load-balance --parallel=4",
Expand Down
26 changes: 0 additions & 26 deletions ui/testem.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
'use strict';

const MultiReporter = require('testem-multi-reporter');
const TapReporter = require('testem/lib/reporters/tap_reporter');
const XunitReporter = require('testem/lib/reporters/xunit_reporter');
const fs = require('fs');

const config = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
Expand Down Expand Up @@ -32,25 +27,4 @@ const config = {
},
};

if (process.env.CI) {
const reporters = [
{
ReporterClass: TapReporter,
args: [false, null, { get: () => false }],
},
{
ReporterClass: XunitReporter,
args: [
false,
fs.createWriteStream('/tmp/test-reports/ui.xml'),
{ get: () => false },
],
},
];

const multiReporter = new MultiReporter({ reporters });

config.reporter = multiReporter;
}

module.exports = config;

0 comments on commit 51ed353

Please sign in to comment.