Skip to content

Commit

Permalink
Merge pull request #1505 from appknox/test-partitioning
Browse files Browse the repository at this point in the history
ember exam test partitioning
  • Loading branch information
future-pirate-king authored Dec 20, 2024
2 parents 0dfdf05 + 7b7ae1c commit ec3bd80
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 9 deletions.
90 changes: 84 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,94 @@ on:
types: [opened, reopened]

jobs:
test:
setup:
name: Setup & Build Application
runs-on: [ubuntu-latest]
concurrency:
group: ${{ github.workflow }}-ci-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4

- name: Setup Application
uses: ./.github/actions/setup-app

- name: Run tests
run: npm test
- name: Build ember app
run: npm run build:test

- name: Upload built ember app
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

lint:
name: Run Linting
needs: [setup]
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

- name: Restore Cached Node Modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Run Linting
run: npm run lint

test:
name: Run ${{ matrix.tests.type }}
needs: [setup]
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
tests:
- type: Unit Tests
commandArgs: --file-path='/irene/tests/unit*.js' --split=3 --parallel=3 --load-balance
- type: Acceptance Tests
commandArgs: --file-path='/irene/tests/acceptance*.js' --split=3 --parallel=3 --load-balance
- type: Integration Tests - Part 1
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=1 --parallel=12 --load-balance
- type: Integration Tests - Part 2
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=2 --parallel=12 --load-balance
- type: Integration Tests - Part 3
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=3 --parallel=12 --load-balance
- type: Integration Tests - Part 4
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=4 --parallel=12 --load-balance
- type: Integration Tests - Part 5
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=5 --parallel=12 --load-balance
- type: Integration Tests - Part 6
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=6 --parallel=12 --load-balance
- type: Integration Tests - Part 7
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=7 --parallel=12 --load-balance
- type: Integration Tests - Part 8
commandArgs: --file-path='/irene/tests/integration*.js' --split=8 --partition=8 --parallel=12 --load-balance
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Restore Cached Node Modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Run ${{ matrix.tests.type }}
run: |
npm run test:ember -- ${{matrix.tests.commandArgs}} --path=dist --wmmf
- name: Job Summary
if: always()
run: |
echo "| Module | Total | Passed | Failed | Skipped | Duration (ms) |" >> $GITHUB_STEP_SUMMARY
echo "| --- | --- | --- | --- | --- | --- |" >> $GITHUB_STEP_SUMMARY
cat module-metadata-*.json | jq -r '.modules[] | "\(.moduleName | gsub("\\|"; "\\\\|")) | \(.total) | \(.passed) | \(.failed) | \(.skipped) | \(.duration) "' >> $GITHUB_STEP_SUMMARY
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import IntlService from 'ember-intl/services/intl';
import MeService from 'irene/services/me';
import OrganizationNamespaceModel from 'irene/models/organization-namespace';

dayjs.extend(relativeTime);

export interface OrganizationNamespaceApprovalStatusSignature {
Args: {
namespace: OrganizationNamespaceModel;
Expand Down Expand Up @@ -59,7 +61,6 @@ export default class OrganizationNamespaceApprovalStatus extends Component<Organ
});

get approvedOnDate() {
dayjs.extend(relativeTime);
return dayjs(this.args.namespace.approvedOn).fromNow();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import OrganizationNamespaceModel from 'irene/models/organization-namespace';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';

dayjs.extend(relativeTime);

export interface OrganizationNamespaceRequestStatusSignature {
Args: {
namespace: OrganizationNamespaceModel;
Expand All @@ -12,7 +14,6 @@ export interface OrganizationNamespaceRequestStatusSignature {

export default class OrganizationNamespaceComponent extends Component<OrganizationNamespaceRequestStatusSignature> {
get createdOnDate() {
dayjs.extend(relativeTime);
return dayjs(this.args.namespace.createdOn).fromNow();
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/components/upload-app/status/details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import { addObserver, removeObserver } from '@ember/object/observers';
import { action } from '@ember/object';
import RouterService from '@ember/routing/router-service';
import { helper } from '@ember/component/helper';
import relativeTime from 'dayjs/plugin/relativeTime';

import { SubmissionModelWithSystemFileData } from '../index';
import ENUMS from 'irene/enums';
import ProjectService from 'irene/services/project';
import UploadAppService from 'irene/services/upload-app';

dayjs.extend(relativeTime);

interface UploadAppStatusDetailsSignature {
Element: HTMLDivElement;
Args: {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"repository": "https://github.com/appknox/irene",
"scripts": {
"build": "ember build --environment=production",
"build:test": "ember build --environment=test",
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:css": "stylelint \"**/*.{css,scss}\" --allow-empty-input",
"lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
Expand All @@ -24,7 +25,7 @@
"startstaging": "cross-env IRENE_API_HOST=https://api.appknox.io ember server",
"startprod": "cross-env IRENE_API_HOST=https://api.appknox.com ember server",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember": "ember exam --split=6 --parallel",
"test:ember": "ember exam",
"cypress:open": "cypress open",
"cypress:run": "cypress run --browser chrome",
"deploy": "ember deploy production --verbose=true --activate=true --show-progress=true",
Expand Down

0 comments on commit ec3bd80

Please sign in to comment.