1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-25 01:32:21 +02:00
goreleaser/CONTRIBUTING.md

117 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2017-01-02 19:08:49 +02:00
# Contributing
By participating in this project, you agree to abide our
[code of conduct](https://github.com/goreleaser/.github/blob/main/CODE_OF_CONDUCT.md).
2017-01-02 19:08:49 +02:00
## Set up your machine
2017-01-02 19:08:49 +02:00
`goreleaser` is written in [Go](https://go.dev/).
2017-01-02 19:08:49 +02:00
That said, we have two different ways of running the tests, regular, and with
Dagger.
### Regular
Prerequisites:
- [Task](https://taskfile.dev/installation)
- [Go 1.23+](https://go.dev/doc/install)
Other things you might need to run some of the tests (they should get
automatically skipped if a needed tool isn't present):
- [cosign](https://github.com/sigstore/cosign)
- [Docker](https://www.docker.com/)
- [GPG](https://gnupg.org)
- [Podman](https://podman.io/)
- [Snapcraft](https://snapcraft.io/)
- [Syft](https://github.com/anchore/syft)
- [upx](https://upx.github.io/)
### Dagger
Prerequisites:
- [Task](https://taskfile.dev/installation)
ci: daggerize test pipeline (#4969) ## What is this? This daggerizes the lint, test, and build pipelines for Goreleaser. ## Why? For context, the previous pass at this can be found here https://github.com/goreleaser/goreleaser/pull/4186 . Since that time, the DX for using Dagger has been considerably improved. The benefit this brings to the Goreleaser project is that the test pipeline can be run locally the same as it is run in CI without requiring contributors to configure additional tools in their developer environments. Additionally, by codifying the test and build execution environments, you no longer need to be concerned with changing or outdated Github Actions runner environments. ## How? As a contributor, you can simply clone/fork Goreleaser and run: `dagger functions` to see which commands are available. To lint local code: `dagger call --source . lint` To run tests against local code: `dagger call --source . test output` To run tests against local code and get the coverage report: `dagger call --source . test coverage-report -o ./coverage.txt` To run tests on the main branch on Github: `dagger call --source=https://github.com/goreleaser/goreleaser test output` To run tests against a PR branch on Github: `dagger call --source=https://github.com/goreleaser/goreleaser#pull/4958/head test output` To run tests against a PR branch using the dagger pipeline committed to the main branch, without checking out goreleaser: `dagger -m github.com/goreleaser/goreleaser call --source=https://github.com/goreleaser/goreleaser#pull/4958/head test output` And so on 😃 ## Also In addition to the Dagger code, I've updated the build.yml workflow to use the test pipeline and updated CONTRIBUTING.md with the command to run tests with Dagger. Note that I did not update the Taskfile.yml to avoid breaking anything for contributors comfortable with their existing workflows. Do you feel that this will benefit the Goreleaser project? Would you like to see the Dagger functions doing more/less? --------- Signed-off-by: kpenfound <kyle@dagger.io> Signed-off-by: Lev Lazinskiy <lev@levlaz.org> Signed-off-by: Lev Lazinskiy <lev@dagger.io> Co-authored-by: Lev Lazinskiy <lev@levlaz.org> Co-authored-by: Lev Lazinskiy <lev@dagger.io>
2024-09-20 04:21:59 +02:00
- [Dagger](https://docs.dagger.io/install)
- [Go 1.23+](https://go.dev/doc/install)
- [Docker](https://www.docker.com/)
2017-01-02 19:08:49 +02:00
## Building
2018-10-31 04:23:47 +02:00
Clone `goreleaser` anywhere:
2017-01-02 19:08:49 +02:00
```sh
git clone git@github.com:goreleaser/goreleaser.git
2017-01-02 19:08:49 +02:00
```
`cd` into the directory and install the dependencies:
2017-01-02 19:08:49 +02:00
2024-07-10 06:27:11 +02:00
```bash
go mod tidy
2017-01-02 19:08:49 +02:00
```
2024-07-10 06:27:11 +02:00
You should then be able to build the binary:
2017-01-02 19:08:49 +02:00
2024-07-10 06:27:11 +02:00
```bash
go build -o goreleaser .
./goreleaser --version
2017-01-02 19:08:49 +02:00
```
## Testing your changes
2017-01-02 19:08:49 +02:00
You can create a branch for your changes and try to build from the source as you go:
2019-03-25 01:10:30 +02:00
```sh
task build
2017-01-02 19:08:49 +02:00
```
When you are satisfied with the changes, we suggest you run:
2019-03-25 01:10:30 +02:00
```sh
task ci
2017-01-02 19:08:49 +02:00
```
Before you commit the changes, we also suggest you run:
```sh
task fmt
```
You can also test it with Dagger:
```bash
dagger call test
```
### A note about Docker multi-arch builds
If you want to properly run the Docker tests, or run `goreleaser release
--snapshot` locally, you might need to setup Docker for it.
You can do so by running:
```sh
task docker:setup
```
### A note about Windows
Make sure to enable "Developer Mode" in Settings.
## Creating a commit
Commit messages should be well formatted, and to make that "standardized", we
are using Conventional Commits.
You can follow the documentation on
[their website](https://www.conventionalcommits.org).
## Submitting a pull request
2017-01-02 19:08:49 +02:00
2021-11-12 22:23:32 +02:00
Push your branch to your `goreleaser` fork and open a pull request against the main branch.
2018-01-24 00:59:29 +02:00
## Financial contributions
2022-09-04 04:27:04 +02:00
You can contribute in our OpenCollective or to any of the contributors directly.
See [this page](https://goreleaser.com/sponsors) for more details.