diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..a220865ac --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,38 @@ +name: Pull request + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + soundness: + name: Soundness + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main + with: + # https://github.com/swiftlang/github-workflows/issues/48 + license_header_check_enabled: false + license_header_check_project_name: "VS Code Swift" + api_breakage_check_enabled: false + docs_check_enabled: false + format_check_enabled: false + shell_check_enabled: true + unacceptable_language_check_enabled: true + + tests: + name: Test + uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main + with: + linux_env_vars: | + NODE_VERSION=v18.19.0 + NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin + NVM_DIR=/usr/local/nvm + CI=1 + FAST_TEST_RUN=1 + linux_pre_build_command: | + apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential + mkdir -p $NVM_DIR + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION" + echo "$NODE_PATH" >> $GITHUB_PATH + linux_build_command: ./docker/test.sh + enable_windows_checks: false diff --git a/.vscode-test.js b/.vscode-test.js index 43e2dcc09..c62c65bd8 100644 --- a/.vscode-test.js +++ b/.vscode-test.js @@ -15,7 +15,7 @@ const { defineConfig } = require("@vscode/test-cli"); const path = require("path"); -const isCIBuild = process.env["CI"] === "1"; +const isCIBuild = false; // process.env["CI"] === "1"; const isFastTestRun = process.env["FAST_TEST_RUN"] === "1"; // "env" in launch.json doesn't seem to work with vscode-test diff --git a/docker/test.sh b/docker/test.sh index c1d26d8ca..b73d277b6 100755 --- a/docker/test.sh +++ b/docker/test.sh @@ -1,6 +1,21 @@ #!/bin/bash set -ex +case $(uname | tr '[:upper:]' '[:lower:]') in + linux*) + export OS_NAME=linux + ;; + darwin*) + export OS_NAME=osx + ;; + msys*) + export OS_NAME=windows + ;; + *) + export OS_NAME=notset + ;; +esac + current_directory=$(pwd) mkdir /tmp/code @@ -19,5 +34,15 @@ npm run lint npm run format npm run package -(xvfb-run -a npm run coverage; echo $? > exitcode) | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" && rm -rf "${current_directory}/coverage" && (cp -R ./coverage "${current_directory}" || true) -exit "$(&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" + exit_code=${PIPESTATUS[0]} +else + npm run coverage 2>&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" + exit_code=${PIPESTATUS[0]} +fi + +rm -rf "${current_directory}/coverage" +cp -R ./coverage "${current_directory}" || true + +exit "${exit_code}" diff --git a/src/TestExplorer/TestRunner.ts b/src/TestExplorer/TestRunner.ts index 10f3d717a..3a64776b7 100644 --- a/src/TestExplorer/TestRunner.ts +++ b/src/TestExplorer/TestRunner.ts @@ -849,6 +849,7 @@ export class TestRunner { ) as vscode.DebugConfiguration[]; const debugRuns = validBuildConfigs.map(config => { + console.log("Debugging with profile", JSON.stringify(config)); return () => new Promise((resolve, reject) => { if (this.testRun.isCancellationRequested) { @@ -858,6 +859,7 @@ export class TestRunner { // add cancelation const startSession = vscode.debug.onDidStartDebugSession(session => { + console.log(">>> Debugging session started", JSON.stringify(session)); if (config.testType === TestLibrary.xctest) { this.testRun.testRunStarted(); } @@ -884,10 +886,12 @@ export class TestRunner { }); subscriptions.push(startSession); + console.log(">>> Start debugging..."); vscode.debug .startDebugging(this.folderContext.workspaceFolder, config) .then( async started => { + console.log(">>> Did start?", started); if (started) { if (config.testType === TestLibrary.swiftTesting) { // Watch the pipe for JSONL output and parse the events into test explorer updates. @@ -925,6 +929,7 @@ export class TestRunner { } }, reason => { + console.log(">>> Failed to start", reason); subscriptions.forEach(sub => sub.dispose()); reject(reason); } @@ -935,6 +940,7 @@ export class TestRunner { // Run each debugging session sequentially await debugRuns.reduce((p, fn) => p.then(() => fn()), Promise.resolve()); }); + console.log(">>> All done!"); } /** Returns a callback that handles a chunk of stdout output from a test run. */ diff --git a/src/debugger/buildConfig.ts b/src/debugger/buildConfig.ts index 3d68c2d9c..dd01c5d96 100644 --- a/src/debugger/buildConfig.ts +++ b/src/debugger/buildConfig.ts @@ -649,6 +649,12 @@ function getBaseConfig(ctx: FolderContext, expandEnvVariables: boolean) { args: [], preLaunchTask: `swift: Build All${nameSuffix}`, terminal: "console", + ...(process.env["CI"] === "1" + ? { + disableASLR: false, + initCommands: ["settings set target.disable-aslr false"], + } + : {}), }; } diff --git a/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts b/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts index 76864d593..6ecf1ed3a 100644 --- a/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts +++ b/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts @@ -66,7 +66,7 @@ suite("Test Explorer Suite", function () { }); } - suite("lldb-dap", () => { + suite.only("lldb-dap", () => { beforeEach(async function () { const testContext = await setupTestExplorerTest({ "swift.debugger.useDebugAdapterFromToolchain": true,