Skip to content

Commit 632b68f

Browse files
ci: Finish migration to Github Actions (#604)
# Motivation I made more progress on the reusable workflows in NIO so it's even easier to adopt them. # Modification This PR fixes up the renamed workflow references and adds unit tests and cxx-interop checks. # Result Green GH actions CI --------- Co-authored-by: Si Beaumont <[email protected]>
1 parent d5f6a6a commit 632b68f

17 files changed

+185
-425
lines changed

Diff for: .github/workflows/pull_request.yml

+68-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,71 @@
1-
name: Pull Request
1+
name: PR
22

33
on:
4-
pull_request:
5-
types: [opened, reopened, synchronize, ready_for_review]
6-
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
77
jobs:
8-
call-reusable-pull-request-workflow:
9-
name: Checks
10-
uses: apple/swift-nio/.github/workflows/reusable_pull_request.yml@main
11-
with:
12-
benchmarks_linux_enabled: false
8+
soundness:
9+
name: Soundness
10+
uses: apple/swift-nio/.github/workflows/soundness.yml@main
11+
with:
12+
api_breakage_check_enabled: true
13+
broken_symlink_check_enabled: true
14+
docs_check_enabled: true
15+
format_check_enabled: true
16+
license_header_check_enabled: true
17+
license_header_check_project_name: "SwiftOpenAPIGenerator"
18+
shell_check_enabled: true
19+
unacceptable_language_check_enabled: true
20+
21+
unit-tests:
22+
name: Unit tests
23+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
24+
with:
25+
linux_5_8_enabled: false
26+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
27+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
28+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
29+
linux_nightly_main_enabled: false
30+
31+
integration-test:
32+
name: Integration test
33+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
34+
with:
35+
name: "Integration test"
36+
matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && ./scripts/run-integration-test.sh"
37+
matrix_linux_5_8_enabled: false
38+
matrix_linux_nightly_main_enabled: false
39+
40+
compatibility-test:
41+
name: Compatibility test
42+
runs-on: ubuntu-latest
43+
container:
44+
image: swift:latest
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
with:
49+
persist-credentials: false
50+
- name: Run OpenAPI document compatibilty test
51+
env:
52+
SWIFT_OPENAPI_COMPATIBILITY_TEST_ENABLE: "true"
53+
SWIFT_OPENAPI_COMPATIBILITY_TEST_SKIP_BUILD: "true"
54+
SWIFT_OPENAPI_COMPATIBILITY_TEST_FILTER: OpenAPIGeneratorReferenceTests.CompatibilityTest
55+
SWIFT_OPENAPI_COMPATIBILITY_TEST_PARALLEL_CODEGEN: "true"
56+
SWIFT_OPENAPI_COMPATIBILITY_TEST_NUM_BUILD_JOBS: 1
57+
run: swift test --filter ${SWIFT_OPENAPI_COMPATIBILITY_TEST_FILTER}
58+
59+
example-packages:
60+
name: Example packages
61+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
62+
with:
63+
name: "Example packages"
64+
matrix_linux_command: "./scripts/test-examples.sh"
65+
matrix_linux_5_8_enabled: false
66+
matrix_linux_nightly_main_enabled: false
67+
68+
swift-6-language-mode:
69+
name: Swift 6 Language Mode
70+
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main
71+
if: false # Disabled for now.

Diff for: .github/workflows/scheduled.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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_8_enabled: false
13+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
14+
linux_5_10_arguments_override: "--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+
integration-test:
19+
name: Integration test
20+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
21+
with:
22+
name: "Integration test"
23+
matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && ./scripts/run-integration-test.sh"
24+
matrix_linux_5_8_enabled: false
25+
26+
example-packages:
27+
name: Example packages
28+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
29+
with:
30+
name: "Example packages"
31+
matrix_linux_command: "./scripts/test-examples.sh"
32+
matrix_linux_5_8_enabled: false

Diff for: .licenseignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.gitignore
2+
.licenseignore
3+
.swiftformatignore
4+
.spi.yml
5+
.swift-format
6+
.github/*
7+
CODE_OF_CONDUCT.md
8+
CONTRIBUTING.md
9+
CONTRIBUTORS.txt
10+
LICENSE.txt
11+
NOTICE.txt
12+
Package.swift
13+
Package.resolved
14+
README.md
15+
SECURITY.md
16+
scripts/unacceptable-language.txt
17+
Tests/PetstoreConsumerTests/Generated
18+
Tests/OpenAPIGeneratorReferenceTests/Resources/ReferenceSources/*
19+
docker/*
20+
**/*.docc/*
21+
**/.gitignore
22+
**/Package.swift
23+
**/Package.resolved
24+
**/README.md
25+
**/openapi.yaml
26+
**/malformed-openapi.yaml
27+
**/openapi.yml
28+
**/petstore.yaml
29+
**/openapi-generator-config.yaml
30+
**/openapi-generator-config.yml
31+
**/docker-compose.yaml
32+
**/docker/*
33+
**/.dockerignore
34+
Plugins/OpenAPIGenerator/PluginsShared
35+
Plugins/OpenAPIGeneratorCommand/PluginsShared
36+
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp.*
37+
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Assets.xcassets/*
38+
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Preview*
39+
Examples/**/Generated*
40+
**/Makefile
41+
**/*.html

Diff for: .swiftformatignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Tests/OpenAPIGeneratorReferenceTests/Resources
2+
Sources/swift-openapi-generator/Documentation.docc
3+
Examples/**/Generated/*
4+
Examples/**/GeneratedSources/*

Diff for: CONTRIBUTING.md

+32-5
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,40 @@ 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-openapi-generator/blob/main/scripts/soundness.sh)
60-
that enforces additional checks, like license headers and formatting style.
59+
You can run the Github Actions workflows locally using
60+
[act](https://github.com/nektos/act). To run all the jobs that run on a pull
61+
request, use the following command:
6162

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.
63+
```
64+
% act pull_request
65+
```
66+
67+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
68+
the job expects. For example, to run just shellcheck:
69+
70+
```
71+
% act workflow_call -j soundness --input shell_check_enabled=true
72+
```
73+
74+
To bind-mount the working directory to the container, rather than a copy, use
75+
`--bind`. For example, to run just the formatting, and have the results
76+
reflected in your working directory:
77+
78+
```
79+
% act --bind workflow_call -j soundness --input format_check_enabled=true
80+
```
81+
82+
If you'd like `act` to always run with certain flags, these can be be placed in
83+
an `.actrc` file either in the current working directory or your home
84+
directory, for example:
85+
86+
```
87+
--container-architecture=linux/amd64
88+
--remote-name upstream
89+
--action-offline-mode
90+
```
6491

6592
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:
6693

Diff for: Package.swift

-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ let package = Package(
6262
// code.
6363
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.3.2"),
6464
.package(url: "https://github.com/apple/swift-http-types", from: "1.0.2"),
65-
66-
// Build and preview docs
67-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
6865
],
6966
targets: [
7067

Diff for: docker/docker-compose.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ services:
2626

2727
soundness:
2828
<<: *common
29-
command: /bin/bash -xcl "swift -version && uname -a && ./scripts/soundness.sh"
29+
command: echo "skipping; moved to Github Actions"
3030

3131
test:
3232
<<: *common
33-
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-} $${STRICT_CONCURRENCY_ARG-}"
33+
command: echo "skipping; moved to Github Actions"
3434

3535
shell:
3636
<<: *common
3737
entrypoint: /bin/bash
3838

3939
integration-test:
4040
<<: *common
41-
command: /bin/bash -xcl "swift -version && uname -a && bash ./scripts/run-integration-test.sh"
41+
command: echo "skipping; moved to Github Actions"
4242
environment:
4343
SWIFT_OPENAPI_GENERATOR_REPO_URL: file:///code
4444

4545
compatibility-test:
4646
<<: *common
47-
command: /bin/bash -xcl "cat /proc/cpuinfo && cat /proc/meminfo && swift test --filter $${SWIFT_OPENAPI_COMPATIBILITY_TEST_FILTER}"
47+
command: echo "skipping; moved to Github Actions"
4848
environment: # These can be overridden when running locally.
4949
SWIFT_OPENAPI_COMPATIBILITY_TEST_ENABLE: "true"
5050
SWIFT_OPENAPI_COMPATIBILITY_TEST_SKIP_BUILD: "true"
@@ -54,10 +54,10 @@ services:
5454

5555
docc-test:
5656
<<: *common
57-
command: /bin/bash -xcl "swift -version && uname -a && bash ./scripts/check-for-docc-warnings.sh"
57+
command: echo "skipping; moved to Github Actions"
5858
environment:
5959
DOCC_TARGET: swift-openapi-generator
6060

6161
examples:
6262
<<: *common
63-
command: /bin/bash -xcl "swift -version && uname -a && bash ./scripts/test-examples.sh"
63+
command: echo "skipping; moved to Github Actions"

Diff for: scripts/check-for-broken-symlinks.sh

-37
This file was deleted.

Diff for: scripts/check-for-docc-warnings.sh

-40
This file was deleted.

Diff for: scripts/check-for-unacceptable-language.sh

-37
This file was deleted.

0 commit comments

Comments
 (0)