Skip to content

Commit 283a37d

Browse files
committed
Add GitHub action to run tests using swift-syntax-dev-utils
swift-syntax-dev-utils also runs the CodeGeneration and Examples tests. It is also a convenient place where we can enable RawSyntax validation and test fuzzing. Running this using only the latest Swift version should be sufficient because we don't expect to find differences between versions here and expect contributors to swift-syntax to use the latests released Swift version anyway.
1 parent 7f98aef commit 283a37d

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,42 @@ jobs:
1515
api_breakage_check_allowlist_path: "Release Notes/api-breakages.txt"
1616
# https://github.com/swiftlang/swift-syntax/issues/2987
1717
docs_check_enabled: false
18+
test_using_swift_syntax_dev_utils_linux:
19+
name: Run tests using swift-syntax-dev-utils (Linux)
20+
runs-on: ubuntu-latest
21+
container:
22+
image: swift:latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
- name: Test
29+
run: "./swift-syntax-dev-utils test --enable-rawsyntax-validation --enable-test-fuzzing --toolchain /usr"
30+
test_using_swift_syntax_dev_utils_windows:
31+
name: Run tests using swift-syntax-dev-utils (Windows)
32+
runs-on: windows-2022
33+
steps:
34+
- name: Pull Docker image
35+
id: pull_docker_image
36+
run: |
37+
$Image = "swift:windowsservercore-ltsc2022"
38+
docker pull $Image
39+
echo "image=$Image" >> "$env:GITHUB_OUTPUT"
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
with:
43+
persist-credentials: false
44+
- name: Test
45+
run: |
46+
mkdir $env:TEMP\test-script
47+
echo @'
48+
Set-PSDebug -Trace 1
49+
50+
$SwiftPath = where.exe swift
51+
swift.exe run --package-path "C:\Source\SwiftSyntaxDevUtils" swift-syntax-dev-utils test --enable-rawsyntax-validation --enable-test-fuzzing --toolchain "$SwiftPath\..\.."
52+
if ($LastExitCode -ne 0) {
53+
exit $LastExitCode
54+
}
55+
'@ >> $env:TEMP\test-script\run.ps1
56+
docker run -v ${{ github.workspace }}:C:\source -v $env:TEMP\test-script:C:\test-script ${{ steps.pull_docker_image.outputs.image }} powershell.exe -NoLogo -File C:\test-script\run.ps1

Examples/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let package = Package(
1313
.executable(name: "CodeGenerationUsingSwiftSyntaxBuilder", targets: ["CodeGenerationUsingSwiftSyntaxBuilder"]),
1414
],
1515
dependencies: [
16-
.package(path: "../")
16+
.package(name: "swift-syntax", path: "../")
1717
],
1818
targets: [
1919
.executableTarget(

0 commit comments

Comments
 (0)