Skip to content

Commit a4d7b0c

Browse files
[CI] GitHub Actions support (#1159)
[CI] GitHub Actions support --------- Co-authored-by: Paul LeMarquand <plemarquand@apple.com>
1 parent de3c2f3 commit a4d7b0c

File tree

8 files changed

+121
-14
lines changed

8 files changed

+121
-14
lines changed

.github/workflows/pull_request.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
soundness:
9+
name: Soundness
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
11+
with:
12+
# Pending https://github.com/swiftlang/vscode-swift/pull/1176
13+
license_header_check_enabled: false
14+
license_header_check_project_name: "VS Code Swift"
15+
api_breakage_check_enabled: false
16+
docs_check_enabled: false
17+
format_check_enabled: false
18+
shell_check_enabled: true
19+
unacceptable_language_check_enabled: true
20+
21+
tests:
22+
name: Test
23+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
24+
with:
25+
linux_exclude_swift_versions: '[{"swift_version": "nightly-main"}]'
26+
linux_env_vars: |
27+
NODE_VERSION=v18.19.0
28+
NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin
29+
NVM_DIR=/usr/local/nvm
30+
CI=1
31+
FAST_TEST_RUN=1
32+
linux_pre_build_command: |
33+
apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential
34+
mkdir -p $NVM_DIR
35+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
36+
/bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION"
37+
echo "$NODE_PATH" >> $GITHUB_PATH
38+
linux_build_command: ./docker/test.sh
39+
enable_windows_checks: false

assets/test/sleep.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
216
sleep "$1"
317
exit "$2"

docker/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
#===----------------------------------------------------------------------===//
2+
#
3+
# This source file is part of the VS Code Swift open source project
4+
#
5+
# Copyright (c) 2024 the VS Code Swift project authors
6+
# Licensed under Apache License v2.0
7+
#
8+
# See LICENSE.txt for license information
9+
# See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
#
13+
#===----------------------------------------------------------------------===//
114
ARG swift_version=5.10
215
ARG ubuntu_version=jammy
316
ARG base_image=swift:$swift_version-$ubuntu_version

docker/test-ci.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
215

316
node << 'EOF'
417
const { execSync } = require('child_process');

docker/test.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
216
set -ex
317

418
current_directory=$(pwd)
@@ -20,5 +34,10 @@ npm run format
2034
npm run package
2135
npm run test-soundness -- --force-run
2236

23-
(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)
24-
exit "$(<exitcode)"
37+
xvfb-run -a npm run coverage 2>&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels"
38+
exit_code=${PIPESTATUS[0]}
39+
40+
rm -rf "${current_directory}/coverage"
41+
cp -R ./coverage "${current_directory}" || true
42+
43+
exit "${exit_code}"

scripts/soundness.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ if [[ "$1" != "--force-run" ]]; then
2525
fi
2626

2727
set -eu
28+
29+
original_dir=$(pwd)
30+
cd "$(dirname "$0")/.."
31+
2832
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2933

3034
function replace_acceptable_years() {
@@ -81,8 +85,8 @@ EOF
8185
;;
8286
esac
8387

84-
expected_lines=$(cat "$tmp" | wc -l)
85-
expected_sha=$(cat "$tmp" | shasum)
88+
expected_lines=$(wc -l < "$tmp")
89+
expected_sha=$(shasum < "$tmp")
8690

8791
(
8892
cd "$here/.."
@@ -98,16 +102,10 @@ EOF
98102
\( \! -path './coverage/*' -a \
99103
\( "${matching_files[@]}" \) \
100104
\) \) \) \) \) \) \) \)
101-
102-
if [[ "$language" = bash ]]; then
103-
# add everything with a shell shebang too
104-
git grep --full-name -l '#!/bin/bash'
105-
git grep --full-name -l '#!/bin/sh'
106-
fi
107-
} | while read line; do
108-
if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
109-
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
110-
diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
105+
} | while read -r line; do
106+
if [[ "$(replace_acceptable_years < "$line" | head -n "$expected_lines" | shasum)" != "$expected_sha" ]]; then
107+
printf "\033[0;31mmissing headers in file '%s'!\033[0m\n" "$line"
108+
diff -u <(replace_acceptable_years < "$line" | head -n "$expected_lines") "$tmp"
111109
exit 1
112110
fi
113111
done
@@ -116,6 +114,7 @@ EOF
116114
done
117115

118116
rm "$tmp"
117+
cd "$original_dir"
119118

120119
# printf "=> Checking for broken links in documentation... "
121120
# find . -name node_modules -prune -o -name \*.md -print0 | xargs -0 -n1 npx markdown-link-check

src/TestExplorer/TestRunner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ export class TestRunner {
925925
}
926926
},
927927
reason => {
928+
this.workspaceContext.outputChannel.logDiagnostic(
929+
`Failed to debug test: ${reason}`
930+
);
928931
subscriptions.forEach(sub => sub.dispose());
929932
reject(reason);
930933
}

src/debugger/buildConfig.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,13 @@ function getBaseConfig(ctx: FolderContext, expandEnvVariables: boolean) {
649649
args: [],
650650
preLaunchTask: `swift: Build All${nameSuffix}`,
651651
terminal: "console",
652+
// DisableASLR when running in Docker CI https://stackoverflow.com/a/78471987
653+
...(process.env["CI"]
654+
? {
655+
disableASLR: false,
656+
initCommands: ["settings set target.disable-aslr false"],
657+
}
658+
: {}),
652659
};
653660
}
654661

0 commit comments

Comments
 (0)