diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0321ca4..4045af5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -29,6 +29,9 @@ jobs: - name: Install PlaydateSDK (Linux) run: ./scripts/installSDKLinux.sh if: runner.os == 'Linux' + - name: Install PlaydateSDK (Windows) + run: .\scripts\createSDKFixture.ps1 + if: runner.os == 'Windows' - name: Run tests (Linux) run: xvfb-run -a yarn test:ci if: runner.os == 'Linux' diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c29baa1..834718f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -26,6 +26,9 @@ jobs: - name: Install PlaydateSDK (Linux) run: ./scripts/installSDKLinux.sh if: runner.os == 'Linux' + - name: Install PlaydateSDK (Windows) + run: .\scripts\createSDKFixture.ps1 + if: runner.os == 'Windows' - name: Run tests (Linux) run: xvfb-run -a yarn test:ci if: runner.os == 'Linux' diff --git a/.gitignore b/.gitignore index cdb7f6e..0331228 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,7 @@ mock-debug.txt *.vsix .DS_Store *.pdx -fixtures/PlaydateSDK-*/* -!fixtures/PlaydateSDK-*/VERSION.txt +fixtures/PlaydateSDK/* .nyc_output/ coverage/ tmp/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 8f7624c..9aa11ed 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,7 +25,7 @@ "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" ], "env": { - "PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK-1.12.3" + "PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK" }, "outFiles": ["${workspaceFolder}/out/**/*.js"], "preLaunchTask": "${defaultBuildTask}" diff --git a/.vscode/settings.json b/.vscode/settings.json index 9262396..753c120 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,7 +24,7 @@ "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" ], "env": { - "PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK-1.12.3" + "PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK" }, "outFiles": ["${workspaceFolder}/out/**/*.js"], "preLaunchTask": "${defaultBuildTask}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa01119..6e07c4a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,6 @@ The test suite selects subsets of tests to run based on the host operating system and the presence of the Playdate SDK. -To run tests against an actual Playdate SDK, copy or install the Playdate SDK to the [fixtures/PlaydateSDK-1.12.3](/fixtures/PlaydateSDK-1.12.3) directory. Tests that depend on an actual Playdate SDK will only run on macOS. +To run tests against an actual Playdate SDK, copy or install the Playdate SDK to the [fixtures/PlaydateSDK](/fixtures/PlaydateSDK) directory. Tests that depend on an actual Playdate SDK will only run on macOS. The [`intallSDKLinux.sh`](/scripts/installSDKLinux.sh) and [`installSDKMacOS.sh`](/scripts/installSDKMacOS.sh) scripts can be used to automatically download and install the Playdate SDK in the fixtures directory on Linux and macOS, respectively. diff --git a/fixtures/PlaydateSDK-1.12.3/VERSION.txt b/fixtures/PlaydateSDK-1.12.3/VERSION.txt deleted file mode 100644 index 81f3632..0000000 --- a/fixtures/PlaydateSDK-1.12.3/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -1.12.3 diff --git a/fixtures/PlaydateSDK-1.13.0/VERSION.txt b/fixtures/PlaydateSDK-1.13.0/VERSION.txt deleted file mode 100644 index feaae22..0000000 --- a/fixtures/PlaydateSDK-1.13.0/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -1.13.0 diff --git a/fixtures/workspace/override-configuration/.vscode/settings.json b/fixtures/workspace/override-configuration/.vscode/settings.json index e4eb954..c5a4ff7 100644 --- a/fixtures/workspace/override-configuration/.vscode/settings.json +++ b/fixtures/workspace/override-configuration/.vscode/settings.json @@ -1,5 +1,5 @@ { - "playdate-debug.sdkPath": "../../PlaydateSDK-1.12.3", + "playdate-debug.sdkPath": "../../PlaydateSDK", "playdate-debug.sourcePath": "../basic-configuration/source", "playdate-debug.outputPath": "./", "playdate-debug.productName": "Override Configuration" diff --git a/scripts/createSDKFixture.ps1 b/scripts/createSDKFixture.ps1 new file mode 100644 index 0000000..6ae96c8 --- /dev/null +++ b/scripts/createSDKFixture.ps1 @@ -0,0 +1,15 @@ +$fixturesDir = Join-Path $PSScriptRoot ".." "fixtures" +$sdkDir = Join-Path $fixturesDir "PlaydateSDK" + +if (-not (Test-Path $sdkDir)) { + New-Item -ItemType Directory -Path $sdkDir -Force | Out-Null + Write-Host "Created directory: $sdkDir" +} else { + Write-Host "Directory already exists: $sdkDir" +} + +$versionFile = Join-Path $sdkDir "VERSION.txt" +$semverVersion = "3.0.0" + +Set-Content -Path $versionFile -Value $semverVersion +Write-Host "Created VERSION.txt with version: $semverVersion" diff --git a/scripts/installSDKLinux.sh b/scripts/installSDKLinux.sh index adf868e..5e4e8a6 100755 --- a/scripts/installSDKLinux.sh +++ b/scripts/installSDKLinux.sh @@ -5,5 +5,7 @@ set -euxo pipefail mkdir tmp cd tmp -wget https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-1.12.3.tar.gz -tar xfz PlaydateSDK-1.12.3.tar.gz -C ../fixtures/ +wget https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-latest.tar.gz +rm -rf ../fixtures/PlaydateSDK +mkdir ../fixtures/PlaydateSDK +tar --strip-components 1 -xzf PlaydateSDK-latest.tar.gz -C ../fixtures/PlaydateSDK/ diff --git a/scripts/installSDKMacOS.sh b/scripts/installSDKMacOS.sh index 7c0621e..3eac894 100755 --- a/scripts/installSDKMacOS.sh +++ b/scripts/installSDKMacOS.sh @@ -2,7 +2,7 @@ set -euxo pipefail -VERSION=${1:-1.12.3} +VERSION=${1:-latest} PLAYDATE_SDK=PlaydateSDK-${VERSION} rm -rf tmp/${VERSION} @@ -20,5 +20,5 @@ fi mkdir out xar -xf "${PKG_FILE}" -C out cat out/PlaydateSDK.pkg/Payload | gunzip -dc | cpio -i -rm -rf ../../fixtures/${PLAYDATE_SDK} -mv PlaydateSDK ../../fixtures/${PLAYDATE_SDK} +rm -rf ../../fixtures/PlaydateSDK +mv PlaydateSDK ../../fixtures/PlaydateSDK diff --git a/src/test/suite/configuration.test.ts b/src/test/suite/configuration.test.ts index 60891ef..4f3c4d1 100644 --- a/src/test/suite/configuration.test.ts +++ b/src/test/suite/configuration.test.ts @@ -90,9 +90,9 @@ suite("Configuration Test Suite", () => { assert.ok(sdkPath); assert.ok(path.isAbsolute(sdkPath)); - assert.ok(sdkPath.endsWith(path.join("/fixtures/PlaydateSDK-1.12.3"))); + assert.ok(sdkPath.endsWith(path.join("/fixtures/PlaydateSDK"))); - assert.strictEqual(sdkVersion, "1.12.3"); + assert.match(sdkVersion, /^\d+\.\d+\.\d+$/); assert.ok(path.isAbsolute(sourcePath)); assert.ok( diff --git a/src/test/suite/pdc.test.ts b/src/test/suite/pdc.test.ts index c23eab2..f0a61b5 100644 --- a/src/test/suite/pdc.test.ts +++ b/src/test/suite/pdc.test.ts @@ -21,7 +21,6 @@ import { withSDK, waitForFileToExist, getFixtureWorkspaceFolder, - skipCI, } from "./suiteTestUtils"; suite("PDC Test Suite", () => { @@ -71,35 +70,33 @@ suite("PDC Test Suite", () => { test( "pdc-configuration", - withSDK( - skipCI(async () => { - const fixture = "pdc-configuration"; - const index = 2; - - const tasks = await vscode.tasks.fetchTasks({ type: TaskType.pdc }); - assert.strictEqual(tasks.length, 3); - assertTaskFixture(tasks[0], "basic-configuration"); - assertTaskFixture(tasks[1], "override-configuration"); - assertTaskFixture(tasks[index], fixture); - - const { sourcePath } = await resolveConfig(fixture); - const originalPDXInfo = await readPDXInfo(sourcePath); - assert.strictEqual(originalPDXInfo.buildNumber, "1"); - - await runTask(tasks[index]); - - const pdxPath = path.resolve( - getFixturePath(fixture), - "PDC Configuration.pdx", - ); - await waitForFileToExist(pdxPath); - - const pdxInfo = await readPDXInfo(sourcePath); - assert.strictEqual(pdxInfo.buildNumber, "2"); - - await cleanPDXBundles(); - await writePDXInfo(originalPDXInfo, sourcePath); - }), - ), + withSDK(async () => { + const fixture = "pdc-configuration"; + const index = 2; + + const tasks = await vscode.tasks.fetchTasks({ type: TaskType.pdc }); + assert.strictEqual(tasks.length, 3); + assertTaskFixture(tasks[0], "basic-configuration"); + assertTaskFixture(tasks[1], "override-configuration"); + assertTaskFixture(tasks[index], fixture); + + const { sourcePath } = await resolveConfig(fixture); + const originalPDXInfo = await readPDXInfo(sourcePath); + assert.strictEqual(originalPDXInfo.buildNumber, "1"); + + await runTask(tasks[index]); + + const pdxPath = path.resolve( + getFixturePath(fixture), + "PDC Configuration.pdx", + ); + await waitForFileToExist(pdxPath); + + const pdxInfo = await readPDXInfo(sourcePath); + assert.strictEqual(pdxInfo.buildNumber, "2"); + + await cleanPDXBundles(); + await writePDXInfo(originalPDXInfo, sourcePath); + }), ); }); diff --git a/src/test/testUtils.ts b/src/test/testUtils.ts index 4fbf8a0..9025b01 100644 --- a/src/test/testUtils.ts +++ b/src/test/testUtils.ts @@ -6,7 +6,7 @@ export function getBaseFixturesPath(): string { export function getPlaydateSDKFixturePath(): string { const baseFixturesPath = getBaseFixturesPath(); - return path.resolve(baseFixturesPath, "PlaydateSDK-1.12.3"); + return path.resolve(baseFixturesPath, "PlaydateSDK"); } export function getWorkspaceFixturesPath(): string {