diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2fe92c5d8..97e6ac9b1 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -70,6 +70,13 @@ jobs: windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1 windows_build_command: Invoke-Program scripts\test_windows.ps1 enable_windows_docker: false + # macOS + enable_macos_checks: true + macos_env_vars: | + CI=1 + FAST_TEST_RUN=${{ contains(github.event.pull_request.labels.*.name, 'full-test-run') && '0' || '1'}} + macos_pre_build_command: . .github/workflows/scripts/setup-macos.sh + macos_build_command: ./scripts/test_macos.sh soundness: name: Soundness diff --git a/.github/workflows/scripts/setup-macos.sh b/.github/workflows/scripts/setup-macos.sh new file mode 100755 index 000000000..5bad64c80 --- /dev/null +++ b/.github/workflows/scripts/setup-macos.sh @@ -0,0 +1,33 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the VS Code Swift open source project +## +## Copyright (c) 2025 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 +## +##===----------------------------------------------------------------------===## + +export NODE_VERSION=v20.19.0 +export NVM_DIR="$RUNNER_TEMP/.nvm" +export NODE_PATH="$NVM_DIR/versions/node/v20.19.0/bin" + +mkdir -p "$NVM_DIR" +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +# shellcheck disable=SC1091 +. "$NVM_DIR/nvm.sh" && nvm install $NODE_VERSION +echo "$NODE_PATH" >> "$GITHUB_PATH" + +env | sort + +if [ -n "$VSCODE_SWIFT_VSIX_ID" ]; then + npm ci --ignore-scripts + npx tsx scripts/download_vsix.ts +fi + +automationmodetool \ No newline at end of file diff --git a/scripts/test_macos.sh b/scripts/test_macos.sh new file mode 100755 index 000000000..ace4cc650 --- /dev/null +++ b/scripts/test_macos.sh @@ -0,0 +1,30 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the VS Code Swift open source project +## +## Copyright (c) 2025 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 + +export NODE_OPTIONS="--dns-result-order=ipv4first" +export npm_config_http_proxy="$HTTP_PROXY" +export npm_config_https_proxy="$HTTPS_PROXY" +export VSCODE_DATA_DIR="$RUNNER_TEMP/ud" + +automationmodetool + +npm ci -ignore-script node-pty +npm run lint +npm run format +npm run coverage + +exit "$?"