Skip to content

Commit 84a055d

Browse files
authored
Merge pull request #149 from incertum/docs-update-sep-2025
update: README.md and CONTRIBUTING.md
2 parents 7bb0c9e + d61edc9 commit 84a055d

File tree

2 files changed

+70
-27
lines changed

2 files changed

+70
-27
lines changed

CONTRIBUTING.md

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@ your contribution to Apple and the community, and agree by submitting the patch
55
that your contributions are licensed under the Apache 2.0 license (see
66
`LICENSE.txt`).
77

8-
## How to submit a bug report
8+
## How to Contribute
99

10-
Please ensure to specify the following:
10+
Contributions to this project are welcome. You can help by opening an issue to report a bug or suggest a feature, or by submitting a pull request with code changes.
1111

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
12+
For security concerns, please follow the private disclosure process outlined in the [SECURITY.md](SECURITY.md) file instead of opening a public issue.
2113

14+
### Reporting Bugs or Requesting Features
2215

23-
### Example
16+
A great bug report or feature request is specific and actionable. Before submitting a new issue, please check if a similar one already exists.
17+
18+
When you create a bug report, please provide the following:
19+
20+
- **swift-prometheus commit hash** you are using.
21+
- **Context**: What were you trying to achieve?
22+
- **Steps to Reproduce**: Provide the simplest possible steps. A pull request with a failing test case is ideal.
23+
- **Environment Details**:
24+
- Swift version (`swift --version`)
25+
- OS version (`uname -a`)
26+
- Any other relevant configuration.
27+
28+
#### Example
2429

2530
```
2631
swift-prometheus commit hash: 22ec043dc9d24bb011b47ece4f9ee97ee5be2757
@@ -47,19 +52,56 @@ Linux beefy.machine 4.4.0-101-generic #124-Ubuntu SMP Fri Nov 10 18:29:59 UTC 20
4752
My system has IPv6 disabled.
4853
```
4954

50-
## Writing a Patch
55+
### Submitting Code Contributions
56+
57+
#### The Development Workflow
58+
59+
1. **Fork & Clone**: Fork the repository and clone it to your local machine.
60+
61+
```bash
62+
git clone https://github.com/YOUR_USERNAME/swift-prometheus.git
63+
cd swift-prometheus
64+
```
65+
66+
2. **Create a Branch**: Create a descriptive branch for your changes (e.g., `fix/counter-overflow` or `feature/new-exporter`).
67+
68+
```bash
69+
git checkout -b fix/counter-overflow
70+
```
71+
72+
3. **Write Code & Tests**: Make your changes. All new code must be accompanied by tests to prevent regressions. For changes that are performance-critical or security-sensitive, we also strongly encourage adding new benchmarks or fuzz tests.
73+
74+
4. **Run Checks Locally**: Before pushing, validate your changes by running the project's automated checks on your local machine.
75+
- **Run Unit Tests**: This is the most fundamental check to ensure your changes haven't broken existing functionality.
76+
77+
```bash
78+
swift test
79+
```
80+
81+
- **Check Code Formatting**: We use `swift-format` to maintain a consistent code style. Run the following command to verify your code is formatted correctly.
82+
83+
```bash
84+
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-swift-format.sh | bash
85+
```
86+
87+
- **Simulate CI Workflows (Optional)**: For a more comprehensive check, you can run the full GitHub Actions workflows locally using [act](https://github.com/nektos/act). This is useful for catching issues that only appear in the CI environment.
88+
- For detailed setup instructions, see the Swift project's guide on [Running Workflows Locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally).
89+
- You can run an entire workflow or target a specific job. For example, to run only the `soundness` check:
90+
```bash
91+
act pull_request --job soundness
92+
```
93+
- You can find the names of all available jobs to target in our [pull_request.yml](.github/workflows/pull_request.yml) file.
5194
52-
A good swift-prometheus patch is:
95+
5. **Commit & Push**: Write a clear commit message following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, then push your branch to your fork.
5396
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.
97+
6. **Open a Pull Request**: Open a PR against the `main` branch. Link any relevant issues in your PR description (e.g., `Fixes #123`).
5898
59-
### Run CI checks locally
99+
#### Pull Request Guidelines
60100
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).
101+
For a smooth review process, your PR should be:
62102
63-
## How to contribute your work
103+
- **Atomic**: Address a single, focused issue or feature.
104+
- **Tested**: Include tests that prove your change works.
105+
- **Documented**: Add DocC comments for any new public APIs.
64106
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.
107+
Once submitted, a maintainer will review your code, provide feedback, and merge it once it's approved. Thank you for your contribution!

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Swift Prometheus
22

33
[![sswg:sandbox](https://img.shields.io/badge/sswg-sandbox-yellow.svg)][SSWG-Incubation]
4-
[![Documentation](http://img.shields.io/badge/read_the-docs-2196f3.svg)][Documentation]
4+
[![Documentation](http://img.shields.io/badge/read_the-docs-2196f3.svg)][Documentation]
5+
[![Supported Swift Versions](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fswift-server%2Fswift-prometheus%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/swift-server/swift-prometheus)
6+
[![Supported Platforms](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fswift-server%2Fswift-prometheus%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/swift-server/swift-prometheus)
57

68
A Swift client library for [Prometheus Monitoring System](https://github.com/prometheus/prometheus).
79

@@ -11,7 +13,7 @@ This can also be used a backend implementation for [Swift Metrics](https://githu
1113

1214
## Installation and Usage
1315

14-
Please refer to the [Documentation][Documentation] for installation, usage instructions, and implementation details including Prometheus standards compliance.
16+
Please see the `swift-prometheus` [DocC Documentation][Documentation] for details on installation, usage, implementation, and Prometheus standards compliance.
1517

1618
For general Prometheus guidance, see [Prometheus Monitoring System][prometheus-docs].
1719

@@ -21,19 +23,18 @@ Please see [SECURITY.md](SECURITY.md) for details on the security process.
2123

2224
## Contributing
2325

24-
We welcome all contributions to `swift-prometheus`! For feature requests or bug reports, please [create an issue](https://github.com/swift-server/swift-prometheus/issues/new) with detailed information including Swift version, platform, and reproduction steps. To contribute code, [fork this repo](https://github.com/swift-server/swift-prometheus/fork) and submit a pull request with tests and documentation updates.
26+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) to learn how you can help, or browse our [open issues](https://github.com/swift-server/swift-prometheus/issues) to find a place to start.
2527

2628
## Benchmarks
2729

28-
Benchmarks are located in the [Benchmarks](/Benchmarks/) subfolder and use the [`package-benchmark`](https://github.com/ordo-one/package-benchmark) plugin. See the [Benchmarks Getting Started]((https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark/gettingstarted#Installing-Prerequisites-and-Platform-Support)) guide for installation instructions. Run benchmarks by navigating to Benchmarks and executing:
30+
Benchmarks are located in the [Benchmarks](/Benchmarks/) subfolder and use the [`package-benchmark`](https://github.com/ordo-one/package-benchmark) plugin. See the [Benchmarks Getting Started](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark/gettingstarted#Installing-Prerequisites-and-Platform-Support) guide for installation instructions. Run benchmarks by navigating to Benchmarks and executing:
2931

3032
```
3133
swift package benchmark
3234
```
3335

3436
For more information please refer to `swift package benchmark --help` or the [`package-benchmark` Documentation](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark).
3537

36-
3738
[Documentation]: https://swiftpackageindex.com/swift-server/swift-prometheus/documentation/prometheus
3839
[prometheus-docs]: https://prometheus.io/docs/introduction/overview/
3940
[SSWG-Incubation]: https://www.swift.org/sswg/incubation-process.html

0 commit comments

Comments
 (0)