Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Adopt GitHub Actions #775

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: SemVer Major
labels:
- ⚠️ semver/major
- title: SemVer Minor
labels:
- semver/minor
- title: SemVer Patch
labels:
- semver/patch
- title: Other Changes
labels:
- semver/none
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Main

on:
push:
branches: [main]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
26 changes: 26 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "SwiftNIO"

unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR label

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
semver-label-check:
name: Semantic Version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main
33 changes: 33 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.gitignore
**/.gitignore
.gitattributes
.git-blame-ignore-revs
.mailfilter
.mailmap
.spi.yml
.swift-format
.editorconfig
.github/*
*.md
*.txt
*.yml
*.yaml
*.json
Package.swift
**/Package.swift
Package@-*.swift
**/Package@-*.swift
Package.resolved
**/Package.resolved
Makefile
*.modulemap
**/*.modulemap
**/*.docc/*
*.xcprivacy
**/*.xcprivacy
*.symlink
**/*.symlink
Dockerfile
**/Dockerfile
Snippets/*
dev/git.commit.template
58 changes: 58 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"indentation" : {
"spaces" : 4
},
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"prioritizeKeepingFunctionOutputTogether" : true,
"respectsExistingLineBreaks" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoAssignmentInExpressions" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : false,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : false,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : true,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 4,
"version" : 1
}
19 changes: 0 additions & 19 deletions .swiftformat

This file was deleted.

76 changes: 76 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Debug Proxy",
"program": "${workspaceFolder:swift-nio-imap}/.build/debug/Proxy",
"preLaunchTask": "swift: Build Debug Proxy"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Release Proxy",
"program": "${workspaceFolder:swift-nio-imap}/.build/release/Proxy",
"preLaunchTask": "swift: Build Release Proxy"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Debug NIOIMAPPerformanceTester",
"program": "${workspaceFolder:swift-nio-imap}/.build/debug/NIOIMAPPerformanceTester",
"preLaunchTask": "swift: Build Debug NIOIMAPPerformanceTester"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Release NIOIMAPPerformanceTester",
"program": "${workspaceFolder:swift-nio-imap}/.build/release/NIOIMAPPerformanceTester",
"preLaunchTask": "swift: Build Release NIOIMAPPerformanceTester"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Debug NIOIMAPFuzzer",
"program": "${workspaceFolder:swift-nio-imap}/.build/debug/NIOIMAPFuzzer",
"preLaunchTask": "swift: Build Debug NIOIMAPFuzzer"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Release NIOIMAPFuzzer",
"program": "${workspaceFolder:swift-nio-imap}/.build/release/NIOIMAPFuzzer",
"preLaunchTask": "swift: Build Release NIOIMAPFuzzer"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Debug CLI",
"program": "${workspaceFolder:swift-nio-imap}/.build/debug/CLI",
"preLaunchTask": "swift: Build Debug CLI"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:swift-nio-imap}",
"name": "Release CLI",
"program": "${workspaceFolder:swift-nio-imap}/.build/release/CLI",
"preLaunchTask": "swift: Build Release CLI"
}
]
}
15 changes: 2 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,14 @@ We require that your commit messages match our template. The easiest way to do t

The default policy for taking contributions is “Squash and Merge” - because of this the commit message format rule above applies to the PR rather than every commit contained within it.

### Make sure Tests work on Linux
### Run CI checks locally

SwiftNIO IMAP uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not (prior to swift 5.1).
For this reason, whenever you add new tests **you have to run a script** that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `ruby ./scripts/generate_linux_tests.rb` at the root of the package and check the changes it made.

### Make sure your patch works for all supported versions of swift

The CI will do this for you. You can use the docker-compose files included if you wish to check locally. Currently all versions of swift >= 5.4 are supported. For example usage of docker compose see the main [README](./README.md#an-alternative-using-docker-compose)
You can run the Github Actions workflows locally using [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).

### Make sure your code is performant

SwiftNIO has been created to be high performance. The integration tests cover some measures of performance including allocations which should be avoided if possible. For help with allocation problems refer to the guide to [allocation debugging](./docs/debugging-allocations.md)

### Formatting

Try to keep your lines less than 120 characters long so github can correctly display your changes.

It is intended SwiftNIO IMAP will use the swift-format tool in the future to bring consistency to code formatting. To follow the discussion on this topic see the swift evolution proposal [SE-250](https://github.com/apple/swift-evolution/blob/main/proposals/0250-swift-style-guide-and-formatter.md)

### Extensibility

Try to make sure your code is robust to future extensions. The public interface is very hard to change after release - please refer to the [SwiftNIO API guidelines](https://github.com/apple/swift-nio/blob/main/docs/public-api.md)
Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ This product contains "Base64.swift", "DecodingError.swift", and "Chromium.swift
* https://github.com/swift-extras/swift-extras-base64

* LICENSE (BSD 2-Clause):
* https://github.com/lemire/fastbase64/blob/master/LICENSE
* https://github.com/lemire/fastbase64/blob/63ed168854875c065bad6c1e6023fbc71f4211df/LICENSE
* HOMEPAGE:
* https://github.com/lemire/fastbase64

* LICENSE (The MIT License):
* https://github.com/client9/stringencoders/blob/master/LICENSE
* https://github.com/client9/stringencoders/blob/7755852327c06a17d95a978dcd013d6789323ded/LICENSE
* HOMEPAGE:
* https://github.com/client9/stringencoders

Expand Down
13 changes: 7 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ import PackageDescription
let package = Package(
name: "swift-nio-imap",
products: [
.library(name: "NIOIMAP", targets: ["NIOIMAP"]),
], dependencies: [
.library(name: "NIOIMAP", targets: ["NIOIMAP"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio", from: "2.64.0"),
.package(url: "https://github.com/apple/swift-nio-ssl", from: "2.24.0"),
.package(url: "https://github.com/apple/swift-log", from: "1.4.4"),
.package(url: "https://github.com/apple/swift-se0270-range-set.git", from: "1.0.1"),
.package(url: "https://github.com/apple/swift-collections.git", "1.1.0" ..< "2.0.0"),
.package(url: "https://github.com/apple/swift-collections.git", "1.1.0"..<"2.0.0"),
],
targets: [
.executableTarget(
name: "NIOIMAPPerformanceTester",
dependencies: [
"NIOIMAP",
"NIOIMAP"
]
),
.target(
name: "NIOIMAP",
dependencies: [
"NIOIMAPCore",
"NIOIMAPCore"
]
),
.testTarget(
Expand Down Expand Up @@ -57,7 +58,7 @@ let package = Package(
.executableTarget(
name: "CLI",
dependencies: [
"CLILib",
"CLILib"
]
),
.target(
Expand Down
Loading
Loading