Skip to content

Commit

Permalink
Merge branch 'main' into run-lint-first
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya authored Dec 11, 2024
2 parents b1ce85f + ac61579 commit c0a4ecf
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 7 deletions.
22 changes: 22 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,25 @@ categories:
- 'test flakiness'
- title: 📦 Dependency updates
label: 'dependencies'
autolabeler:
- label: 'breaking change'
title:
- '/^[a-z]+(\(.+\))?!\:/'
- label: 'security'
title:
- '/^security(\(.+\))?!?\:/'
- label: 'feature'
title:
- '/^feat(\(.+\))?!?\:/'
- label: 'bug'
title:
- '/^(fix)(\(.+\))?!?\:/'
- label: 'documentation'
title:
- '/^docs(\(.+\))?!?\:/'
- label: 'chore'
title:
- '/^chore(\(.+\))?!?\:/'
- label: 'dependencies'
title:
- '/^deps(\(.+\))?!?\:/'
8 changes: 3 additions & 5 deletions .github/workflows/ci-test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ jobs:
steps:
- name: Setup rootless Docker
if: ${{ inputs.rootless-docker }}
uses: ScribeMD/rootless-docker@6bd157a512c2fafa4e0243a8aa87d964eb890886 # v0.2.2

- name: Remove Docker root socket
if: ${{ inputs.rootless-docker }}
run: sudo rm -rf /var/run/docker.sock
uses: docker/setup-docker-action@01efb57f882e3b1a22e7cf3501dbe51287b0ecb4 # v4
with:
rootless: true

- name: Check out code into the Go module directory
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/conventions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Enforce conventions"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: read

jobs:
lint-pr:
name: Validate PR title follows Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# We may not need a scope on every commit (i.e. repo-level change).
#
# feat!: read config consistenly
# feat(redis): support for clustering
# chore(redis): update tests
# fix(redis): trim connection string
# ^ ^ ^
# | | |__ Subject
# | |_______ Scope
# |____________ Type: it can end with a ! to denote a breaking change.
requireScope: false
# Scope should be lowercase.
disallowScopes: |
[A-Z]+
# ensures the subject doesn't start with an uppercase character.
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
types: |
security
fix
feat
docs
chore
deps
2 changes: 1 addition & 1 deletion .github/workflows/docker-moby-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: go mod tidy

- name: Install Nightly Docker
uses: crazy-max/ghaction-setup-docker@master
uses: docker/setup-docker-action@master
with:
rootless: ${{ matrix.rootless-docker }}
version: type=image,tag=master
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
push:
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]

permissions:
contents: read
Expand All @@ -17,5 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v5.19.0
with:
disable-autolabeler: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 13 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ Please just be sure to:
* follow the style, naming and structure conventions of the rest of the project.
* make commits atomic and easy to merge.
* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for the PR title. This will help us to understand the nature of the changes, and to generate the changelog after all the commits in the PR are squashed.
* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages, as it improves the readability of the commit history, and the review process.
* Please use the `feat!`, `chore!`, `fix!`... types for breaking changes, as these categories are considered as `breaking change` in the changelog. Please use the `!` to denote a breaking change.
* Please use the `security` type for security fixes, as these categories are considered as `security` in the changelog.
* Please use the `feat` type for new features, as these categories are considered as `feature` in the changelog.
* Please use the `fix` type for bug fixes, as these categories are considered as `bug` in the changelog.
* Please use the `docs` type for documentation updates, as these categories are considered as `documentation` in the changelog.
* Please use the `chore` type for housekeeping commits, including `build`, `ci`, `style`, `refactor`, `test`, `perf` and so on, as these categories are considered as `chore` in the changelog.
* Please use the `deps` type for dependency updates, as these categories are considered as `dependencies` in the changelog.

!!!important
There is a GitHub Actions workflow that will check if your PR title follows the conventional commits convention. If not, it contributes a failed check to your PR.
To know more about the conventions, please refer to the [workflow file](https://github.com/testcontainers/testcontainers-go/blob/main/.github/workflows/conventions.yml).

* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages, as it improves the readability of the commit history, and the review process. Please follow the above conventions for the PR title.
* unless necessary, please try to **avoid pushing --force** to the published branch you submitted a PR from, as it makes it harder to review the changes from a given previous state.
* apply format running `make lint-all`. It will run `golangci-lint` for the core and modules with the configuration set in the root directory of the project. Please be aware that the lint stage on CI could fail if this is not done.
* For linting just the modules: `make -C modules lint-modules`
Expand Down

0 comments on commit c0a4ecf

Please sign in to comment.