Skip to content

ci: Move to GitHub Actions #57

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

Merged
merged 8 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 -Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
# Disable strict concurrency checking as it intersects badly with
# warnings-as-errors on 5.10 and later as SwiftPMs generated test manifest
# has a non-sendable global property.
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
# TODO: Enable warnings-as-errors on 6.0.
linux_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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: "SwiftOpenAPIGenerator"

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 -Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
# Disable strict concurrency checking as it intersects badly with
# warnings-as-errors on 5.10 and later as SwiftPMs generated test manifest
# has a non-sendable global property.
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
# TODO: Enable warnings-as-errors on 6.0.
linux_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "-Xswiftc -strict-concurrency=complete --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
9 changes: 9 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.gitignore
.licenseignore
.swiftformatignore
.spi.yml
.swift-format
.github/
**.md
**.txt
**Package.swift
4 changes: 2 additions & 2 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1
builder:
configs:
- documentation_targets:
- OpenAPIURLSession
- documentation_targets:
- OpenAPIURLSession
39 changes: 25 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,40 @@ A good patch is:
3. Documented, adding API documentation as needed to cover new functions and properties.
4. Accompanied by a great commit message, using our commit message template.

### Run `./scripts/soundness.sh`
## Running CI workflows locally

The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-openapi-urlsession/blob/main/scripts/soundness.sh)
that enforces additional checks, like license headers and formatting style.
You can run the Github Actions workflows locally using
[act](https://github.com/nektos/act). To run all the jobs that run on a pull
request, use the following command:

Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
on minor changes such as a missing `self.` or similar formatting issues.
```bash
% act pull_request
```

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), which you can do via executing the following command in the project root directory:
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
the job expects. For example, to run just shellcheck:

```bash
cat << EOF > .git/hooks/pre-push

if [[ -f "scripts/soundness.sh" ]]; then
scripts/soundness.sh
fi
EOF
% act workflow_call -j soundness --input shell_check_enabled=true
```

Which makes the script execute, and only allow the `git push` to complete if the check has passed.
To bind-mount the working directory to the container, rather than a copy, use
`--bind`. For example, to run just the formatting, and have the results
reflected in your working directory:

```bash
% act --bind workflow_call -j soundness --input format_check_enabled=true
```

In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again.
If you'd like `act` to always run with certain flags, these can be be placed in
an `.actrc` file either in the current working directory or your home
directory, for example:

```bash
--container-architecture=linux/amd64
--remote-name upstream
--action-offline-mode
```
## How to contribute your work

Please open a pull request at https://github.com/apple/swift-openapi-urlsession. Make sure the CI passes, and then wait for code review.
23 changes: 5 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@ if ProcessInfo.processInfo.environment["SWIFT_OPENAPI_STRICT_CONCURRENCY"].flatM

let package = Package(
name: "swift-openapi-urlsession",
platforms: [
.macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)
],
products: [
.library(
name: "OpenAPIURLSession",
targets: ["OpenAPIURLSession"]
),
],
platforms: [.macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)],
products: [.library(name: "OpenAPIURLSession", targets: ["OpenAPIURLSession"])],
dependencies: [
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
],
targets: [
Expand All @@ -52,22 +44,17 @@ let package = Package(
dependencies: [
.product(name: "DequeModule", package: "swift-collections"),
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "HTTPTypes", package: "swift-http-types")
.product(name: "HTTPTypes", package: "swift-http-types"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "OpenAPIURLSessionTests",
dependencies: [
"OpenAPIURLSession",
.product(name: "NIOTestUtils", package: "swift-nio"),
],
dependencies: ["OpenAPIURLSession", .product(name: "NIOTestUtils", package: "swift-nio")],
swiftSettings: swiftSettings
),
]
)

// Test-only dependencies.
package.dependencies += [
.package(url: "https://github.com/apple/swift-nio", from: "2.62.0")
]
package.dependencies += [.package(url: "https://github.com/apple/swift-nio", from: "2.62.0")]
23 changes: 0 additions & 23 deletions docker/Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions docker/docker-compose.2204.510.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions docker/docker-compose.2204.59.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions docker/docker-compose.2204.590.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions docker/docker-compose.2204.main.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions docker/docker-compose.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions scripts/check-for-broken-symlinks.sh

This file was deleted.

Loading