-
Notifications
You must be signed in to change notification settings - Fork 185
136 lines (125 loc) · 6.43 KB
/
Copy pathpull_request.yml
File metadata and controls
136 lines (125 loc) · 6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Pull request
permissions:
contents: read
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.15
with:
enable_macos_checks: true
linux_host_archs: '["x86_64", "aarch64"]'
linux_swift_versions: '["nightly-main", "nightly-6.3"]'
windows_swift_versions: '["nightly-main", "nightly-6.3"]'
# The package and tests build on Windows, but the tests don't pass yet,
# due to issues with filenames on Windows. For now, the Windows CI runs
# build the package, and only build the tests without running them.
# Filenames PR: https://github.com/swiftlang/swift-docc/pull/668
windows_build_command: "Invoke-Program swift build --build-tests"
cmake:
name: CMake
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.15
with:
enable_linux_checks: false
windows_swift_versions: '["nightly-6.3"]'
windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1 -InstallCMake -SkipAndroid'
windows_build_command: |
$Src = Join-Path $PWD ".build\checkouts"
$Bin = Join-Path $PWD "BinaryCache"
$Install = Join-Path $PWD "InstallCache"
$CMakeArgs = @(
"-DCMAKE_MAKE_PROGRAM=$((Get-Command ninja).Path)",
"-DCMAKE_C_COMPILER=$((Get-Command clang).Path)",
"-DCMAKE_CXX_COMPILER=$((Get-Command clang).Path)",
"-DCMAKE_Swift_COMPILER=$((Get-Command swiftc).Path)",
"-DCMAKE_STATIC_LIBRARY_PREFIX_Swift=lib",
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
)
function Build($BinDir, $SrcDir, $ConfigureArgs) {
Invoke-Program cmake -B $BinDir -G Ninja -DCMAKE_BUILD_TYPE=Release @ConfigureArgs @CMakeArgs -S $SrcDir
Invoke-Program cmake --build $BinDir
}
# Build dependencies
Invoke-Program swift package resolve
Build "$Bin\swift-argument-parser" "$Src\swift-argument-parser" @("-DBUILD_SHARED_LIBS=YES", "-DBUILD_TESTING=NO", "-DBUILD_EXAMPLES=NO")
Build "$Bin\swift-asn1" "$Src\swift-asn1" @("-DBUILD_SHARED_LIBS=NO")
Build "$Bin\swift-crypto" "$Src\swift-crypto" @("-DBUILD_SHARED_LIBS=NO", "-DSwiftASN1_DIR=$Bin\swift-asn1\cmake\modules")
Build "$Bin\swift-cmark" "$Src\swift-cmark" @("-DBUILD_SHARED_LIBS=YES", "-DBUILD_TESTING=NO")
# cmark-gfm's exported CMake config is only complete after an install
Invoke-Program cmake --install "$Bin\swift-cmark" --prefix "$Install\swift-cmark"
Build "$Bin\swift-markdown" "$Src\swift-markdown" @("-DBUILD_SHARED_LIBS=NO", "-DArgumentParser_DIR=$Bin\swift-argument-parser\cmake\modules", "-Dcmark-gfm_DIR=$Install\swift-cmark\lib\cmake")
Build "$Bin\swift-lmdb" "$Src\swift-lmdb" @("-DBUILD_SHARED_LIBS=NO")
Build "$Bin\swift-docc-symbolkit" "$Src\swift-docc-symbolkit" @("-DBUILD_SHARED_LIBS=NO")
# Build DocC
Build "$Bin\swift-docc" "$PWD" @("-DBUILD_SHARED_LIBS=YES", "-DArgumentParser_DIR=$Bin\swift-argument-parser\cmake\modules", "-DSwiftASN1_DIR=$Bin\swift-asn1\cmake\modules", "-DSwiftCrypto_DIR=$Bin\swift-crypto\cmake\modules", "-DSwiftMarkdown_DIR=$Bin\swift-markdown\cmake\modules", "-DLMDB_DIR=$Bin\swift-lmdb\cmake\modules", "-DSymbolKit_DIR=$Bin\swift-docc-symbolkit\cmake\modules", "-Dcmark-gfm_DIR=$Install\swift-cmark\lib\cmake")
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.15
with:
license_header_check_project_name: "Swift"
# The license header check is disabled as it requires a large number of changes.
license_header_check_enabled: false
# There are some words in typical programming jargon that are a part of the default list.
# The list of words checked by this job is restricted below to prevent raising issues for
# words that are contextually acceptable to use in this repository.
unacceptable_language_check_word_list: "blacklist whitelist slave master" # ignore-unacceptable-language
# The format check is disabled as this project does not conform to swift-format.
# More discussion is needed before enabling this check.
format_check_enabled: false
# The docs check is disabled as it requires a large number of changes.
docs_check_enabled: false
# Detect which auxiliary packages are affected by the PR,
# so that the build jobs only run when relevant.
changes:
name: Detect changed packages
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
make_test_bundle: ${{ steps.filter.outputs.make_test_bundle }}
benchmark: ${{ steps.filter.outputs.benchmark }}
steps:
- id: filter
env:
GH_TOKEN: ${{ github.token }}
run: |
changed="$(gh api --paginate \
"repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \
--jq '.[].filename')"
echo "Changed files:"
echo "$changed"
make_test_bundle=false
benchmark=false
# `bin/make-test-bundle` has no dependencies, only check its source.
if echo "$changed" | grep -qE '^bin/make-test-bundle/'; then make_test_bundle=true; fi
# `bin/benchmark` depends on the benchmark schema in `Sources/SwiftDocC/Benchmark/`.
# Build and test it if its source or this dependency changes.
if echo "$changed" | grep -qE '^(bin/benchmark/|Sources/SwiftDocC/Benchmark/|Package\.(swift|resolved)$)'; then benchmark=true; fi
echo "make_test_bundle=$make_test_bundle" >> "$GITHUB_OUTPUT"
echo "benchmark=$benchmark" >> "$GITHUB_OUTPUT"
make-test-bundle:
name: Build bin/make-test-bundle
needs: changes
if: ${{ needs.changes.outputs.make_test_bundle == 'true' }}
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-main-jammy
steps:
- uses: actions/checkout@v7
- run: swift build --package-path bin/make-test-bundle
benchmark:
name: Build and test bin/benchmark
needs: changes
if: ${{ needs.changes.outputs.benchmark == 'true' }}
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-main-jammy
steps:
- uses: actions/checkout@v7
- run: swift test --parallel --package-path bin/benchmark