|
| 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 | +* Commit hash |
| 13 | +* Contextual information (e.g. what you were trying to achieve with swift-java) |
| 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 | + |
| 21 | +### Example |
| 22 | + |
| 23 | +``` |
| 24 | +Commit hash: b17a8a9f0f814c01a56977680cb68d8a779c951f |
| 25 | +
|
| 26 | +Context: |
| 27 | +While testing my application that uses with swift-openapi-generator, I noticed that ... |
| 28 | +
|
| 29 | +Steps to reproduce: |
| 30 | +1. ... |
| 31 | +2. ... |
| 32 | +3. ... |
| 33 | +4. ... |
| 34 | +
|
| 35 | +$ swift --version |
| 36 | +Swift version 4.0.2 (swift-4.0.2-RELEASE) |
| 37 | +Target: x86_64-unknown-linux-gnu |
| 38 | +
|
| 39 | +Operating system: Ubuntu Linux 16.04 64-bit |
| 40 | +
|
| 41 | +$ uname -a |
| 42 | +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 |
| 43 | +
|
| 44 | +My system has IPv6 disabled. |
| 45 | +``` |
| 46 | + |
| 47 | +## Writing a Patch |
| 48 | + |
| 49 | +A good patch is: |
| 50 | + |
| 51 | +1. Concise, and contains as few changes as needed to achieve the end result. |
| 52 | +2. Tested, ensuring that any tests provided failed before the patch and pass after it. |
| 53 | +3. Documented, adding API documentation as needed to cover new functions and properties. |
| 54 | +4. Accompanied by a great commit message, using our commit message template. |
| 55 | + |
| 56 | +### Run CI checks locally |
| 57 | + |
| 58 | +You can run the Github Actions workflows locally using |
| 59 | +[act](https://github.com/nektos/act). To run all the jobs that run on a pull |
| 60 | +request, use the following command: |
| 61 | + |
| 62 | +``` |
| 63 | +% act pull_request |
| 64 | +``` |
| 65 | + |
| 66 | +To run just a single job, use `workflow_call -j <job>`, and specify the inputs |
| 67 | +the job expects. For example, to run just shellcheck: |
| 68 | + |
| 69 | +``` |
| 70 | +% act workflow_call -j soundness --input shell_check_enabled=true |
| 71 | +``` |
| 72 | + |
| 73 | +To bind-mount the working directory to the container, rather than a copy, use |
| 74 | +`--bind`. For example, to run just the formatting, and have the results |
| 75 | +reflected in your working directory: |
| 76 | + |
| 77 | +``` |
| 78 | +% act --bind workflow_call -j soundness --input format_check_enabled=true |
| 79 | +``` |
| 80 | + |
| 81 | +If you'd like `act` to always run with certain flags, these can be be placed in |
| 82 | +an `.actrc` file either in the current working directory or your home |
| 83 | +directory, for example: |
| 84 | + |
| 85 | +``` |
| 86 | +--container-architecture=linux/amd64 |
| 87 | +--remote-name upstream |
| 88 | +--action-offline-mode |
| 89 | +``` |
| 90 | + |
| 91 | +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: |
| 92 | + |
| 93 | +```bash |
| 94 | +cat << EOF > .git/hooks/pre-push |
| 95 | +
|
| 96 | +if [[ -f "scripts/soundness.sh" ]]; then |
| 97 | + scripts/soundness.sh |
| 98 | +fi |
| 99 | +EOF |
| 100 | +``` |
| 101 | + |
| 102 | +Which makes the script execute, and only allow the `git push` to complete if the check has passed. |
| 103 | + |
| 104 | +In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again. |
| 105 | + |
| 106 | +## How to contribute your work |
| 107 | + |
| 108 | +Please open a pull request at https://github.com/swiftlang/swift-java. Make sure the CI passes, and then wait for code review. |
| 109 | + |
0 commit comments