Skip to content

Commit

Permalink
Add upscaler build as dependency in tests (#1153)
Browse files Browse the repository at this point in the history
* Add upscaler build as dependency in tests
  • Loading branch information
thekevinscott authored Oct 4, 2023
1 parent baef393 commit d25b0c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 43 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ jobs:
with:
gdrive_credentials_data: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}

- name: 'Build Upscaler'
run: pnpm test:integration:browserstack -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:integration:browserstack -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand Down Expand Up @@ -177,9 +174,6 @@ jobs:
# with:
# detached: true

- name: 'Build Upscaler'
run: pnpm test:integration:browser -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:integration:browser -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand Down Expand Up @@ -208,9 +202,6 @@ jobs:
with:
gdrive_credentials_data: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}

- name: 'Build Upscaler'
run: pnpm test:integration:node -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:integration:node -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand Down Expand Up @@ -245,9 +236,6 @@ jobs:
# with:
# detached: true

- name: 'Build Upscaler'
run: pnpm test:model -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:model -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand All @@ -274,9 +262,6 @@ jobs:
with:
gdrive_credentials_data: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}

- name: 'Build Upscaler'
run: pnpm test:model -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:model -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand All @@ -303,9 +288,6 @@ jobs:
with:
gdrive_credentials_data: ${{ secrets.GDRIVE_CREDENTIALS_DATA }}

- name: 'Build Upscaler'
run: pnpm test:memory-leaks -- --ci --verbose --skipTest --skipModelBuild --skipBundle

- name: 'Build Models'
run: pnpm test:memory-leaks -- --ci --verbose --skipTest --skipUpscalerBuild --skipBundle

Expand Down
28 changes: 23 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,37 @@
"command": "ts-node test/lib/start-test-server.ts"
},
"test:integration:browserstack": {
"command": "pnpm --filter @upscalerjs/scripts test:integration:browserstack"
"command": "pnpm --filter @upscalerjs/scripts test:integration:browserstack",
"dependencies": [
"./packages/upscalerjs:build:browser"
]
},
"test:integration:browser": {
"command": "pnpm --filter @upscalerjs/scripts test:integration:browser"
"command": "pnpm --filter @upscalerjs/scripts test:integration:browser",
"dependencies": [
"./packages/upscalerjs:build:browser"
]
},
"test:integration:node": {
"command": "pnpm --filter @upscalerjs/scripts test:integration:node"
"command": "echo 1",
"dependencies": [
"./packages/upscalerjs:build:node-gpu",
"./packages/upscalerjs:build:node"
]
},
"test:model": {
"command": "pnpm --filter @upscalerjs/scripts test:model"
"command": "pnpm --filter @upscalerjs/scripts test:model",
"dependencies": [
"./packages/upscalerjs:build:node-gpu",
"./packages/upscalerjs:build:node",
"./packages/upscalerjs:build:browser"
]
},
"test:memory-leaks": {
"command": "pnpm --filter @upscalerjs/scripts test:memory-leaks"
"command": "pnpm --filter @upscalerjs/scripts test:memory-leaks",
"dependencies": [
"./packages/upscalerjs:build:browser"
]
},
"test:unit:browser:playwright": {
"command": "pnpm --filter upscaler test:unit:browser:playwright"
Expand Down
20 changes: 0 additions & 20 deletions scripts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const getPlatformsToBuild = (platform: Platform | Platform[]): TargetPlatform[]
const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind, positionalArgs: (string | number)[], {
browserstackAccessKey,
verbose,
skipUpscalerBuild,
skipModelBuild,
forceModelRebuild,
skipBundle,
Expand All @@ -132,7 +131,6 @@ const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind,
watch,
}: {
browserstackAccessKey?: string;
skipUpscalerBuild?: boolean;
skipModelBuild?: boolean;
forceModelRebuild?: boolean;
verbose?: boolean;
Expand All @@ -155,22 +153,6 @@ const test = async (platform: Platform | Platform[], runner: Runner, kind: Kind,
}
}

if (skipUpscalerBuild !== true) {
const platformsToBuild = getPlatformsToBuild(platform);

const durations: number[] = [];
for (let i = 0; i < platformsToBuild.length; i++) {
const start = performance.now();
await runPNPMScript(`build:${platformsToBuild[i]}`, 'upscaler')
const duration = performance.now() - start;
durations.push(duration);
}
console.log([
`** built upscaler: ${platform}`,
...platformsToBuild.map((platformToBuild, i) => ` - ${platformToBuild} in ${durations?.[i]} ms`),
].join('\n'));
}

if (skipBundle !== true) {
const dependencies = await getDependencies(platform, runner, kind, ...positionalArgs);
if (dependencies.length === 0) {
Expand Down Expand Up @@ -269,7 +251,6 @@ interface Args {
watch?: boolean;
platform: Platform | Platform[];
skipBundle?: boolean;
skipUpscalerBuild?: boolean;
skipModelBuild?: boolean;
forceModelRebuild?: boolean;
runner: Runner;
Expand Down Expand Up @@ -333,7 +314,6 @@ const getArgs = async (): Promise<Args> => {
const argv = await yargs(process.argv.slice(2)).options({
watch: { type: 'boolean' },
platform: { type: 'string' },
skipUpscalerBuild: { type: 'boolean' },
skipModelBuild: { type: 'boolean' },
skipBundle: { type: 'boolean' },
skipTest: { type: 'boolean' },
Expand Down
2 changes: 2 additions & 0 deletions test/integration/node/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ describe('Node Platforms Integration Tests', () => {
'tf': `@tensorflow/tfjs-${platform}`,
'Upscaler': `${LOCAL_UPSCALER_NAME}/${platform}`,
},
}, {
removeTmpDir: false,
});
const formattedResult = `data:image/png;base64,${result}`;
checkImage(formattedResult, path.resolve(PIXEL_UPSAMPLER_DIR, "4x/result.png"), 'diff.png');
Expand Down

0 comments on commit d25b0c4

Please sign in to comment.