diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..4a55a027f --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,39 @@ +name: Pull request + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + soundness: + name: Soundness + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main + with: + # Pending https://github.com/swiftlang/vscode-swift/pull/1176 + 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_exclude_swift_versions: '[{"swift_version": "nightly-main"}]' + 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/assets/test/sleep.sh b/assets/test/sleep.sh index 2eeb6d110..3bbe0bd72 100755 --- a/assets/test/sleep.sh +++ b/assets/test/sleep.sh @@ -1,3 +1,17 @@ #!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the VS Code Swift open source project +## +## Copyright (c) 2021 the VS Code Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of VS Code Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + sleep "$1" exit "$2" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index eddec6e42..b14fd44e6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,3 +1,16 @@ +#===----------------------------------------------------------------------===// +# +# This source file is part of the VS Code Swift open source project +# +# Copyright (c) 2024 the VS Code Swift project authors +# Licensed under Apache License v2.0 +# +# See LICENSE.txt for license information +# See CONTRIBUTORS.txt for the list of VS Code Swift project authors +# +# SPDX-License-Identifier: Apache-2.0 +# +#===----------------------------------------------------------------------===// ARG swift_version=5.10 ARG ubuntu_version=jammy ARG base_image=swift:$swift_version-$ubuntu_version diff --git a/docker/test-ci.sh b/docker/test-ci.sh index 35c8382cf..710002a14 100755 --- a/docker/test-ci.sh +++ b/docker/test-ci.sh @@ -1,4 +1,17 @@ #!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the VS Code Swift open source project +## +## Copyright (c) 2021 the VS Code Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of VS Code Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## node << 'EOF' const { execSync } = require('child_process'); diff --git a/docker/test.sh b/docker/test.sh index c017ba53d..c522df292 100755 --- a/docker/test.sh +++ b/docker/test.sh @@ -1,4 +1,18 @@ #!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the VS Code Swift open source project +## +## Copyright (c) 2021 the VS Code Swift project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of VS Code Swift project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + set -ex current_directory=$(pwd) @@ -20,5 +34,10 @@ npm run format npm run package npm run test-soundness -- --force-run -(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]} + +rm -rf "${current_directory}/coverage" +cp -R ./coverage "${current_directory}" || true + +exit "${exit_code}" diff --git a/scripts/soundness.sh b/scripts/soundness.sh index 4e8e3651b..897e9b31c 100755 --- a/scripts/soundness.sh +++ b/scripts/soundness.sh @@ -25,6 +25,10 @@ if [[ "$1" != "--force-run" ]]; then fi set -eu + +original_dir=$(pwd) +cd "$(dirname "$0")/.." + here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function replace_acceptable_years() { @@ -81,8 +85,8 @@ EOF ;; esac - expected_lines=$(cat "$tmp" | wc -l) - expected_sha=$(cat "$tmp" | shasum) + expected_lines=$(wc -l < "$tmp") + expected_sha=$(shasum < "$tmp") ( cd "$here/.." @@ -98,16 +102,10 @@ EOF \( \! -path './coverage/*' -a \ \( "${matching_files[@]}" \) \ \) \) \) \) \) \) \) \) - - if [[ "$language" = bash ]]; then - # add everything with a shell shebang too - git grep --full-name -l '#!/bin/bash' - git grep --full-name -l '#!/bin/sh' - fi - } | while read line; do - if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then - printf "\033[0;31mmissing headers in file '$line'!\033[0m\n" - diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp" + } | while read -r line; do + if [[ "$(replace_acceptable_years < "$line" | head -n "$expected_lines" | shasum)" != "$expected_sha" ]]; then + printf "\033[0;31mmissing headers in file '%s'!\033[0m\n" "$line" + diff -u <(replace_acceptable_years < "$line" | head -n "$expected_lines") "$tmp" exit 1 fi done @@ -116,6 +114,7 @@ EOF done rm "$tmp" +cd "$original_dir" # printf "=> Checking for broken links in documentation... " # find . -name node_modules -prune -o -name \*.md -print0 | xargs -0 -n1 npx markdown-link-check diff --git a/src/TestExplorer/TestRunner.ts b/src/TestExplorer/TestRunner.ts index 60171e775..51cde990d 100644 --- a/src/TestExplorer/TestRunner.ts +++ b/src/TestExplorer/TestRunner.ts @@ -925,6 +925,9 @@ export class TestRunner { } }, reason => { + this.workspaceContext.outputChannel.logDiagnostic( + `Failed to debug test: ${reason}` + ); subscriptions.forEach(sub => sub.dispose()); reject(reason); } diff --git a/src/debugger/buildConfig.ts b/src/debugger/buildConfig.ts index 3d68c2d9c..4837141a6 100644 --- a/src/debugger/buildConfig.ts +++ b/src/debugger/buildConfig.ts @@ -649,6 +649,13 @@ function getBaseConfig(ctx: FolderContext, expandEnvVariables: boolean) { args: [], preLaunchTask: `swift: Build All${nameSuffix}`, terminal: "console", + // DisableASLR when running in Docker CI https://stackoverflow.com/a/78471987 + ...(process.env["CI"] + ? { + disableASLR: false, + initCommands: ["settings set target.disable-aslr false"], + } + : {}), }; }