Skip to content

Commit 7a1c380

Browse files
authored
Merge pull request #9771 from github/redsun82/swift-integration-test-runner
Swift: locally run integration tests
2 parents 4c6a977 + 24da81f commit 7a1c380

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+146
-6
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Swift: Run Integration Tests"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "swift/**"
7+
- .github/workflows/swift-integration-tests.yml
8+
- codeql-workspace.yml
9+
branches:
10+
- main
11+
defaults:
12+
run:
13+
working-directory: swift
14+
15+
jobs:
16+
integration-tests:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os:
22+
- ubuntu-20.04
23+
# - macos-latest TODO
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: ./.github/actions/fetch-codeql
27+
- uses: bazelbuild/setup-bazelisk@v2
28+
- uses: actions/setup-python@v3
29+
- name: Build Swift extractor
30+
run: |
31+
bazel run //swift:create-extractor-pack
32+
- name: Run integration tests
33+
run: |
34+
python integration-tests/runner.py

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ WORKSPACE.bazel @github/codeql-ci-reviewers
4242
/.github/workflows/js-ml-tests.yml @github/codeql-ml-powered-queries-reviewers
4343
/.github/workflows/ql-for-ql-* @github/codeql-ql-for-ql-reviewers
4444
/.github/workflows/ruby-* @github/codeql-ruby
45+
/.github/workflows/swift-* @github/codeql-c

swift/integration-tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ xcuserdata/
66
DerivedData/
77
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
88
*.actual
9+
db
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
recreation of internal `create_database_utils.py` to run the tests locally, with minimal
3+
and swift-specialized functionality
4+
"""
5+
import subprocess
6+
import pathlib
7+
import sys
8+
9+
10+
def run_codeql_database_create(cmds, lang, keep_trap=True):
11+
assert lang == 'swift'
12+
codeql_root = pathlib.Path(__file__).parents[2]
13+
cmd = [
14+
"codeql", "database", "create",
15+
"-s", ".", "-l", "swift", "--internal-use-lua-tracing", f"--search-path={codeql_root}",
16+
]
17+
if keep_trap:
18+
cmd.append("--keep-trap")
19+
for c in cmds:
20+
cmd += ["-c", c]
21+
cmd.append("db")
22+
res = subprocess.run(cmd)
23+
if res.returncode:
24+
print("FAILED", file=sys.stderr)
25+
print(" ", *cmd, file=sys.stderr)
26+
sys.exit(res.returncode)

swift/integration-tests/cross-references/Functions.expected

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)