Skip to content

Commit 96656a8

Browse files
Migrate CI to GitHub Actions (#57)
1 parent df333bd commit 96656a8

21 files changed

+111
-551
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 8,20 * * *"
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit tests
12+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
13+
with:
14+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
15+
# Disable strict concurrency checking as it intersects badly with
16+
# warnings-as-errors on 5.10 and later as SwiftPMs generated test manifest
17+
# has a non-sendable global property.
18+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
19+
# TODO: Enable warnings-as-errors on 6.0.
20+
linux_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
21+
linux_nightly_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
22+
linux_nightly_main_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"

.github/workflows/pull_request.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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: "SwiftOpenAPIGenerator"
13+
14+
unit-tests:
15+
name: Unit tests
16+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
17+
with:
18+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
19+
# Disable strict concurrency checking as it intersects badly with
20+
# warnings-as-errors on 5.10 and later as SwiftPMs generated test manifest
21+
# has a non-sendable global property.
22+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
23+
# TODO: Enable warnings-as-errors on 6.0.
24+
linux_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
25+
linux_nightly_6_0_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
26+
linux_nightly_main_arguments_override: "-Xswiftc -strict-concurrency=complete --explicit-target-dependency-import-check error"
27+
28+
cxx-interop:
29+
name: Cxx interop
30+
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

.licenseignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.gitignore
2+
.licenseignore
3+
.swiftformatignore
4+
.spi.yml
5+
.swift-format
6+
.github/
7+
**.md
8+
**.txt
9+
**Package.swift

.spi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: 1
22
builder:
33
configs:
4-
- documentation_targets:
5-
- OpenAPIURLSession
4+
- documentation_targets:
5+
- OpenAPIURLSession

CONTRIBUTING.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,40 @@ A good patch is:
5858
3. Documented, adding API documentation as needed to cover new functions and properties.
5959
4. Accompanied by a great commit message, using our commit message template.
6060

61-
### Run `./scripts/soundness.sh`
61+
## Running CI workflows locally
6262

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

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

69-
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:
71+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
72+
the job expects. For example, to run just shellcheck:
7073

7174
```bash
72-
cat << EOF > .git/hooks/pre-push
73-
74-
if [[ -f "scripts/soundness.sh" ]]; then
75-
scripts/soundness.sh
76-
fi
77-
EOF
75+
% act workflow_call -j soundness --input shell_check_enabled=true
7876
```
7977

80-
Which makes the script execute, and only allow the `git push` to complete if the check has passed.
78+
To bind-mount the working directory to the container, rather than a copy, use
79+
`--bind`. For example, to run just the formatting, and have the results
80+
reflected in your working directory:
81+
82+
```bash
83+
% act --bind workflow_call -j soundness --input format_check_enabled=true
84+
```
8185

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

90+
```bash
91+
--container-architecture=linux/amd64
92+
--remote-name upstream
93+
--action-offline-mode
94+
```
8495
## How to contribute your work
8596

8697
Please open a pull request at https://github.com/apple/swift-openapi-urlsession. Make sure the CI passes, and then wait for code review.

Package.swift

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,11 @@ if ProcessInfo.processInfo.environment["SWIFT_OPENAPI_STRICT_CONCURRENCY"].flatM
3131

3232
let package = Package(
3333
name: "swift-openapi-urlsession",
34-
platforms: [
35-
.macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)
36-
],
37-
products: [
38-
.library(
39-
name: "OpenAPIURLSession",
40-
targets: ["OpenAPIURLSession"]
41-
),
42-
],
34+
platforms: [.macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)],
35+
products: [.library(name: "OpenAPIURLSession", targets: ["OpenAPIURLSession"])],
4336
dependencies: [
4437
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
4538
.package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"),
46-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
4739
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
4840
],
4941
targets: [
@@ -52,22 +44,17 @@ let package = Package(
5244
dependencies: [
5345
.product(name: "DequeModule", package: "swift-collections"),
5446
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
55-
.product(name: "HTTPTypes", package: "swift-http-types")
47+
.product(name: "HTTPTypes", package: "swift-http-types"),
5648
],
5749
swiftSettings: swiftSettings
5850
),
5951
.testTarget(
6052
name: "OpenAPIURLSessionTests",
61-
dependencies: [
62-
"OpenAPIURLSession",
63-
.product(name: "NIOTestUtils", package: "swift-nio"),
64-
],
53+
dependencies: ["OpenAPIURLSession", .product(name: "NIOTestUtils", package: "swift-nio")],
6554
swiftSettings: swiftSettings
6655
),
6756
]
6857
)
6958

7059
// Test-only dependencies.
71-
package.dependencies += [
72-
.package(url: "https://github.com/apple/swift-nio", from: "2.62.0")
73-
]
60+
package.dependencies += [.package(url: "https://github.com/apple/swift-nio", from: "2.62.0")]

docker/Dockerfile

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

docker/docker-compose.2204.510.yaml

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

docker/docker-compose.2204.59.yaml

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

docker/docker-compose.2204.590.yaml

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

docker/docker-compose.2204.main.yaml

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

docker/docker-compose.yaml

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

scripts/check-for-broken-symlinks.sh

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

0 commit comments

Comments
 (0)