Skip to content

Commit fb4436c

Browse files
authored
Basic GitHub Actions setup (#48)
### Motivation Want to more to new modern CI ### Modifications Setup some standard actions. Notably missing api break check right now. ### Result GitHub Actions used for CI. ### Test Plan This is largely tests.
1 parent 92ae16f commit fb4436c

32 files changed

+289
-488
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
unit-tests:
9+
name: Unit tests
10+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
11+
with:
12+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
13+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
14+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
16+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
17+
18+
cxx-interop:
19+
name: Cxx interop
20+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

.github/workflows/pull_request.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR
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+
license_header_check_project_name: "SwiftAsyncDNSResolver"
13+
yamllint_check_enabled: false
14+
api_breakage_check_enabled: false
15+
16+
unit-tests:
17+
name: Unit tests
18+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
19+
with:
20+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
21+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
22+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
23+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
24+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
25+
26+
cxx-interop:
27+
name: Cxx interop
28+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, reopened, synchronize]
6+
7+
jobs:
8+
semver-label-check:
9+
name: Semantic Version label check
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Check for Semantic Version label
18+
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

.github/workflows/scheduled.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Scheduled
2+
3+
on:
4+
schedule:
5+
- cron: "0 8,20 * * *"
6+
7+
jobs:
8+
unit-tests:
9+
name: Unit tests
10+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
11+
with:
12+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
13+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
14+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
16+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
17+
18+
cxx-interop:
19+
name: Cxx interop
20+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

.licenseignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.gitignore
2+
.licenseignore
3+
.swiftformatignore
4+
.spi.yml
5+
.swift-format
6+
.github/
7+
**.md
8+
**.txt
9+
**Package.swift
10+
docker/*
11+
.gitmodules
12+
.editorconfig
13+
Sources/CAsyncDNSResolver/c-ares

.swift-format

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"version" : 1,
3+
"indentation" : {
4+
"spaces" : 4
5+
},
6+
"tabWidth" : 4,
7+
"fileScopedDeclarationPrivacy" : {
8+
"accessLevel" : "private"
9+
},
10+
"spacesAroundRangeFormationOperators" : false,
11+
"indentConditionalCompilationBlocks" : false,
12+
"indentSwitchCaseLabels" : false,
13+
"lineBreakAroundMultilineExpressionChainComponents" : false,
14+
"lineBreakBeforeControlFlowKeywords" : false,
15+
"lineBreakBeforeEachArgument" : true,
16+
"lineBreakBeforeEachGenericRequirement" : true,
17+
"lineLength" : 120,
18+
"maximumBlankLines" : 1,
19+
"respectsExistingLineBreaks" : true,
20+
"prioritizeKeepingFunctionOutputTogether" : true,
21+
"rules" : {
22+
"AllPublicDeclarationsHaveDocumentation" : false,
23+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
24+
"AlwaysUseLowerCamelCase" : false,
25+
"AmbiguousTrailingClosureOverload" : true,
26+
"BeginDocumentationCommentWithOneLineSummary" : false,
27+
"DoNotUseSemicolons" : true,
28+
"DontRepeatTypeInStaticProperties" : true,
29+
"FileScopedDeclarationPrivacy" : true,
30+
"FullyIndirectEnum" : true,
31+
"GroupNumericLiterals" : true,
32+
"IdentifiersMustBeASCII" : true,
33+
"NeverForceUnwrap" : false,
34+
"NeverUseForceTry" : false,
35+
"NeverUseImplicitlyUnwrappedOptionals" : false,
36+
"NoAccessLevelOnExtensionDeclaration" : true,
37+
"NoAssignmentInExpressions" : true,
38+
"NoBlockComments" : true,
39+
"NoCasesWithOnlyFallthrough" : true,
40+
"NoEmptyTrailingClosureParentheses" : true,
41+
"NoLabelsInCasePatterns" : true,
42+
"NoLeadingUnderscores" : false,
43+
"NoParensAroundConditions" : true,
44+
"NoVoidReturnOnFunctionSignature" : true,
45+
"OmitExplicitReturns" : true,
46+
"OneCasePerLine" : true,
47+
"OneVariableDeclarationPerLine" : true,
48+
"OnlyOneTrailingClosureArgument" : true,
49+
"OrderedImports" : true,
50+
"ReplaceForEachWithForLoop" : true,
51+
"ReturnVoidInsteadOfEmptyTuple" : true,
52+
"UseEarlyExits" : false,
53+
"UseExplicitNilCheckInConditions" : false,
54+
"UseLetInEveryBoundCaseVariable" : false,
55+
"UseShorthandTypeNames" : true,
56+
"UseSingleLinePropertyGetter" : false,
57+
"UseSynthesizedInitializer" : false,
58+
"UseTripleSlashForDocumentationComments" : true,
59+
"UseWhereClausesInForLoops" : false,
60+
"ValidateDocumentationComments" : false
61+
}
62+
}

.swiftformat

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

CONTRIBUTING.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,10 @@ A good patch is:
5454
3. Documented, adding API documentation as needed to cover new functions and properties.
5555
4. Accompanied by a great commit message, using our commit message template.
5656

57-
### Run `./scripts/soundness.sh`
57+
### Run CI checks locally
5858

59-
The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-async-dns-resolver/blob/main/scripts/soundness.sh)
60-
that enforces additional checks, like license headers and formatting style.
61-
62-
Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
63-
on minor changes such as a missing `self.` or similar formatting issues.
64-
65-
For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks),
66-
which you can do via executing the following command in the project root directory:
67-
68-
```bash
69-
cat << EOF > .git/hooks/pre-push
70-
71-
if [[ -f "scripts/soundness.sh" ]]; then
72-
scripts/soundness.sh
73-
fi
74-
EOF
75-
```
76-
77-
Which makes the script execute, and only allow the `git push` to complete if the check has passed.
78-
79-
In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again.
59+
You can run the Github Actions workflows locally using
60+
[act](https://github.com/nektos/act). For detailed steps on how to do this please see [https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally).
8061

8162
## How to contribute your work
8263

Package.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// swift-tools-version:5.6
22

3-
import class Foundation.FileManager
43
import PackageDescription
54

5+
import class Foundation.FileManager
6+
67
var caresExclude = [
78
"./c-ares/src/lib/cares.rc",
89
"./c-ares/src/lib/CMakeLists.txt",
@@ -22,11 +23,9 @@ do {
2223
let package = Package(
2324
name: "swift-async-dns-resolver",
2425
products: [
25-
.library(name: "AsyncDNSResolver", targets: ["AsyncDNSResolver"]),
26-
],
27-
dependencies: [
28-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
26+
.library(name: "AsyncDNSResolver", targets: ["AsyncDNSResolver"])
2927
],
28+
dependencies: [],
3029
targets: [
3130
.target(
3231
name: "CAsyncDNSResolver",
@@ -43,7 +42,7 @@ let package = Package(
4342
.target(
4443
name: "AsyncDNSResolver",
4544
dependencies: [
46-
"CAsyncDNSResolver",
45+
"CAsyncDNSResolver"
4746
]
4847
),
4948

0 commit comments

Comments
 (0)