Skip to content

Commit fb12ce4

Browse files
committed
Add test action
1 parent 2a1d54c commit fb12ce4

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/Package.swift

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version:5.9
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "SwiftLintPluginsTest",
7+
platforms: [
8+
.macOS(.v12),
9+
],
10+
products: [
11+
.executable(name: "Runner", targets: ["Runner"]),
12+
],
13+
dependencies: [
14+
.package(name: nil, path: "../SwiftLintPlugins"),
15+
],
16+
targets: [
17+
.executableTarget(
18+
name: "Runner",
19+
plugins: [
20+
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins"),
21+
]
22+
),
23+
]
24+
)

.github/workflows/test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests
2+
3+
on: ["pull_request", "push"]
4+
5+
env:
6+
XCODE_VERSION: '15.0'
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
jobs:
13+
plugin:
14+
name: Test Plugin
15+
runs-on: macos-13
16+
steps:
17+
- name: Select Xcode
18+
uses: maxim-lobanov/setup-xcode@v1
19+
with:
20+
xcode-version: ${{ env.XCODE_VERSION }}
21+
- name: Checkout SwiftLintPlugins
22+
uses: actions/checkout@v4
23+
with:
24+
path: SwiftLintPlugins
25+
- name: Create project directory
26+
run: mkdir SwiftLintPluginsTest
27+
- name: Configure project
28+
run: |
29+
swift package init --type executable
30+
cp ../SwiftLintPlugins/.github/workflows/Package.swift .
31+
echo "let myVar : Int = 0" > Sources/main.swift
32+
working-directory: ./SwiftLintPluginsTest
33+
- name: Build project and check findings
34+
run: swift build 2>&1 | grep -q "Colon Spacing Violation"
35+
working-directory: ./SwiftLintPluginsTest
36+
- name: Verify command plugin
37+
run: |
38+
swift package swiftlint --help
39+
swift package swiftlint --version
40+
swift package swiftlint 2>&1 | grep -q "Colon Spacing Violation"
41+
working-directory: ./SwiftLintPluginsTest

0 commit comments

Comments
 (0)