Skip to content

Commit 046eada

Browse files
authored
Migrate to GitHub Actions (#117)
Migrate CI to use GitHub Actions. Motivation: To migrate to GitHub actions and centralised infrastructure. Modifications: Changes of note: * Bump minimum Swift version to 5.9 in line with CI coverage. * Update license header wording. * Add CONTRIBUTING.md. * Remove scripts and docker files which are no longer needed. Result: Feature parity with old CI plus additional soundness checks.
1 parent a6dc986 commit 046eada

32 files changed

+206
-454
lines changed

.editorconfig

+8
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/release.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- ⚠️ semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none

.github/workflows/main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 --explicit-target-dependency-import-check error"
15+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
16+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
17+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
18+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

.github/workflows/pull_request.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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: "SwiftPrometheus"
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 --explicit-target-dependency-import-check error"
19+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
20+
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
21+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
22+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
23+
24+
cxx-interop:
25+
name: Cxx interop
26+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
+18
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

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.gitignore
2+
**/.gitignore
3+
.licenseignore
4+
.gitattributes
5+
.git-blame-ignore-revs
6+
.mailfilter
7+
.mailmap
8+
.spi.yml
9+
.swift-format
10+
.swiftformatignore
11+
.editorconfig
12+
.github/*
13+
*.md
14+
*.txt
15+
*.yml
16+
*.yaml
17+
*.json
18+
Package.swift
19+
**/Package.swift
20+
Package@-*.swift
21+
**/Package@-*.swift
22+
Package.resolved
23+
**/Package.resolved
24+
Makefile
25+
*.modulemap
26+
**/*.modulemap
27+
**/*.docc/*
28+
*.xcprivacy
29+
**/*.xcprivacy
30+
*.symlink
31+
**/*.symlink
32+
Dockerfile
33+
**/Dockerfile
34+
Snippets/*
35+
dev/git.commit.template
36+
.unacceptablelanguageignore

CONTRIBUTING.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## Legal
2+
3+
By submitting a pull request, you represent that you have the right to license
4+
your contribution to Apple and the community, and agree by submitting the patch
5+
that your contributions are licensed under the Apache 2.0 license (see
6+
`LICENSE.txt`).
7+
8+
## How to submit a bug report
9+
10+
Please ensure to specify the following:
11+
12+
* swift-prometheus commit hash
13+
* Contextual information (e.g. what you were trying to achieve with swift-prometheus)
14+
* Simplest possible steps to reproduce
15+
* More complex the steps are, lower the priority will be.
16+
* A pull request with failing test case is preferred, but it's just fine to paste the test case into the issue description.
17+
* Anything that might be relevant in your opinion, such as:
18+
* Swift version or the output of `swift --version`
19+
* OS version and the output of `uname -a`
20+
* Network configuration
21+
22+
23+
### Example
24+
25+
```
26+
swift-prometheus commit hash: 22ec043dc9d24bb011b47ece4f9ee97ee5be2757
27+
28+
Context:
29+
While load testing my program written with swift-prometheus, I noticed
30+
that one file descriptor is leaked per request.
31+
32+
Steps to reproduce:
33+
1. ...
34+
2. ...
35+
3. ...
36+
4. ...
37+
38+
$ swift --version
39+
Swift version 4.0.2 (swift-4.0.2-RELEASE)
40+
Target: x86_64-unknown-linux-gnu
41+
42+
Operating system: Ubuntu Linux 16.04 64-bit
43+
44+
$ uname -a
45+
Linux beefy.machine 4.4.0-101-generic #124-Ubuntu SMP Fri Nov 10 18:29:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
46+
47+
My system has IPv6 disabled.
48+
```
49+
50+
## Writing a Patch
51+
52+
A good swift-prometheus patch is:
53+
54+
1. Concise, and contains as few changes as needed to achieve the end result.
55+
2. Tested, ensuring that any tests provided failed before the patch and pass after it.
56+
3. Documented, adding API documentation as needed to cover new functions and properties.
57+
4. Accompanied by a great commit message, using our commit message template.
58+
59+
### Run CI checks locally
60+
61+
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).
62+
63+
## How to contribute your work
64+
65+
Please open a pull request at https://github.com/swift-server/swift-prometheus. Make sure the CI passes, and then wait for code review.

LICENSE LICENSE.txt

File renamed without changes.

Package.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// This source file is part of the SwiftPrometheus open source project
55
//
6-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
6+
// Copyright (c) 2018-$§ Apple Inc. and the SwiftPrometheus project authors
77
// Licensed under Apache License v2.0
88
//
99
// See LICENSE.txt for license information
@@ -22,14 +22,11 @@ let package = Package(
2222
.library(
2323
name: "Prometheus",
2424
targets: ["Prometheus"]
25-
),
25+
)
2626
],
2727
dependencies: [
2828
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.2"),
2929
.package(url: "https://github.com/apple/swift-metrics.git", from: "2.4.1"),
30-
31-
// ~~~ SwiftPM Plugins ~~~
32-
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.3.0"),
3330
],
3431
targets: [
3532
.target(
@@ -42,7 +39,7 @@ let package = Package(
4239
.testTarget(
4340
name: "PrometheusTests",
4441
dependencies: [
45-
"Prometheus",
42+
"Prometheus"
4643
]
4744
),
4845
]

Sources/Prometheus/Counter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/Docs.docc/swift-metrics.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ generated in a third party library.
111111

112112
#### Default buckets
113113

114-
Swift Metric ``Timer``s are backed by a Prometheus ``DurationHistogram`` and Swift Metric
115-
``Recorder``s that aggregate are backed by a Prometheus ``ValueHistogram``. As a user, you can
114+
Swift Metric `Timer`s are backed by a Prometheus ``DurationHistogram`` and Swift Metric
115+
`Recorder`s that aggregate are backed by a Prometheus ``ValueHistogram``. As a user, you can
116116
specify which buckets shall be used within the backing ``Histogram``s.
117117

118118
```swift

Sources/Prometheus/Gauge.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/Histogram.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/NIOLock.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2023 SwiftPrometheus project authors
5+
// Copyright (c) 2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/NIOLockedValueBox.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2023 SwiftPrometheus project authors
5+
// Copyright (c) 2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/PrometheusCollectorRegistry.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Sources/Prometheus/PrometheusMetricsFactory.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information
@@ -19,20 +19,20 @@ public struct PrometheusMetricsFactory: Sendable {
1919
private static let _defaultRegistry = PrometheusCollectorRegistry()
2020

2121
/// The default ``PrometheusCollectorRegistry``, which is used inside the ``PrometheusMetricsFactory``
22-
/// if no other is provided in ``init(client:)`` or set via ``PrometheusMetricsFactory/client``
22+
/// if no other is provided in ``init(registry:)`` or set via ``PrometheusMetricsFactory/registry``
2323
public static var defaultRegistry: PrometheusCollectorRegistry {
2424
self._defaultRegistry
2525
}
2626

2727
/// The underlying ``PrometheusCollectorRegistry`` that is used to generate the swift-metrics handlers
2828
public var registry: PrometheusCollectorRegistry
2929

30-
/// The default histogram buckets for a ``TimeHistogram``. If there is no explicit overwrite
30+
/// The default histogram buckets for a ``DurationHistogram``. If there is no explicit overwrite
3131
/// via ``durationHistogramBuckets``, the buckets provided here will be used for any new
3232
/// Swift Metrics `Timer` type.
3333
public var defaultDurationHistogramBuckets: [Duration]
3434

35-
/// The histogram buckets for a ``TimeHistogram`` per Timer label
35+
/// The histogram buckets for a ``DurationHistogram`` per Timer label
3636
public var durationHistogramBuckets: [String: [Duration]]
3737

3838
/// The default histogram buckets for a ``ValueHistogram``. If there is no explicit overwrite

Tests/PrometheusTests/CounterTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Tests/PrometheusTests/GaugeTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Tests/PrometheusTests/HistogramTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Tests/PrometheusTests/PrometheusCollectorRegistryTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Tests/PrometheusTests/PrometheusMetricsFactoryTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2018-2023 SwiftPrometheus project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

Tests/PrometheusTests/ValidNamesTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the SwiftPrometheus open source project
44
//
5-
// Copyright (c) 2024 SwiftPrometheus project authors
5+
// Copyright (c) 2024 Apple Inc. and the SwiftPrometheus project authors
66
// Licensed under Apache License v2.0
77
//
88
// See LICENSE.txt for license information

0 commit comments

Comments
 (0)