Skip to content

Commit

Permalink
add contributing guide
Browse files Browse the repository at this point in the history
Sets the basic linter and test suite
also defines the contributing guide
and sets the github pr template
  • Loading branch information
petrkotas committed Mar 22, 2024
1 parent 70e7761 commit 64e0501
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 6 deletions.
51 changes: 51 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. Consider creating this PR as draft, for early feedback ping code owners
2. Structure your PR accordingly to the focus areas, e.g. `api` containing all exposed API specs
3. Write meaningful commit messages and PR description
For more details, please check the [CONTRIBUTING](../CONTRIBUTING.md) guide.
-->

### What this PR does
**Before this PR:**

**After this PR:**

Jira: <!-- optional: link to Jira issue -->
Link to demo recording: <!-- optional: link to a demo recording -->

### Breadcrumbs
The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place: <!-- optional: slack, GH issue, mailinglist, ... -->

### Special notes for your reviewer

<!-- optional -->

### Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

- [ ] Design: An [ADR](https://drive.google.com/drive/folders/1zr2gubRU-asXjZSFZvKmcuGOV4jlUGV-) or [DDR](https://drive.google.com/drive/folders/1L9R0mtcl-5oRc9dzRdcw4ZGVJLtj-14o?usp=drive_link) was considered and is present (link) or not required
- [ ] PR: The PR description is expressive enough and will help future contributors
- [ ] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [ ] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and addressed if required
- [ ] Deployment: The deployemnt process was considered and addressed if required
- [ ] Testing: New code requires new unit tests.
- [ ] Documentation: Is the documentation updated? Either in the doc located in focus area, in the README or in the code itself.
- [ ] Customers: Is this change affecting customers? Is the release plan considered?

### Release note
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
```

31 changes: 25 additions & 6 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ on:
branches:
- 'main'
paths:
- '**.go'
- 'frontend/**'
- 'internal/**'
- '**/go.mod'
- '**/go.sum'
- 'go.work'


jobs:
test:
name: test
permissions:
contents: 'read'
runs-on: 'ubuntu-latest'
strategy:
matrix:
directory: [frontend, internal]
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
Expand All @@ -23,12 +30,20 @@ jobs:
with:
go-version-file: 'go.work'
check-latest: true
cache: false

- name: 'Test'
run: make test
uses: robherley/[email protected]
with:
moduleDirectory: ${{ matrix.directory }}

lint:
name: lint
permissions:
contents: 'read'
pull-requests: read
# Allow to write comments to annotate code in the PR.
checks: write
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
Expand All @@ -40,9 +55,13 @@ jobs:
with:
go-version-file: 'go.work'
check-latest: true
cache: false

- name: 'Lint'
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: 'v1.56.2'
args: '-v $(go list -f ''{{.Dir}}/...'' -m | xargs)'
# NOTE: This needs to be kept in sync with the version in .devcontainer/postCreate.sh
version: v1.55.2
working-directory: ${{ matrix.directory }}
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing to ARO HCP

Welcome to the ARO HCP project! We appreciate your interest in contributing. This guide will help you get started with the contribution process.


## Table of Contents
- [Getting Started](#getting-started)
- [Contributing Guidelines](#contributing-guidelines)
- [Code of Conduct](#code-of-conduct)
- [License](#license)


## Getting Started
To contribute to ARO HCP, follow these steps:

1. Fork the repository to your GitHub account.
2. Clone the forked repository to your local machine.
3. Create a new branch for your changes.
4. Make your changes and commit them.
5. Push your changes to your forked repository.
6. Submit a pull request to the main repository.


## Contributing Guidelines
Please follow these guidelines when contributing to ARO HCP:

- Please consider, starting with a draft PR, unless you are ready for review. If you want a early feedback,
do not hesitate to ping the code owners.
- Write meaningful commit messages and PR description. The PR will be squashed before merging, unless
the splitting into multiple commits is explicitly needed in order to separate changes and allow
later `git bisect`.
- The repository is structured according to the focus areas, e.g. `api` containing all exposed API specs.
When you contribute, please follow this structure and add your contribution to the appropriate folder.
When in doubt, open PR early and ask for feedback.
- When applicable, please always cover new functionality with the appropriate tests.
- When adding functionality, that is not yet implemented, please write appropriate documentation.
When in doubt, ask yourself what it took you to understand the functionality, and what would you need
to know to use it.
- When adding new features, please consider to record a short video showing how it works and explaining
the use case. This will help others to understand better even before digging into the code. When done,
upload the recording to the [Drive](https://drive.google.com/drive/folders/1RB1L2-nGMXwsOAOYC-VGGbB0yD3Ae-rD?usp=drive_link) and share the link in the PR.

Please note, that you might be asked to comply with these guidelines before your PR is accepted.


## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.


## License
ARO HCP is licensed under the Apache License, Version 2.0. Please see the [LICENSE](LICENSE) file for more details.
9 changes: 9 additions & 0 deletions frontend/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json
run:
timeout: "5m"
issues-exit-code: 1
# include tests
tests: true
go: "1.22"


7 changes: 7 additions & 0 deletions internal/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json
run:
timeout: "5m"
issues-exit-code: 1
# include tests
tests: true
go: "1.22"

0 comments on commit 64e0501

Please sign in to comment.