Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Goreleaser (backport #2437) #2463

Merged
merged 2 commits into from
Sep 13, 2023
Merged

build: Goreleaser (backport #2437) #2463

merged 2 commits into from
Sep 13, 2023

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 11, 2023

This is an automatic backport of pull request #2437 done by Mergify.
Cherry-pick of 59a76d3 has failed:

On branch mergify/bp/v1.x/pr-2437
Your branch is up to date with 'origin/v1.x'.

You are currently cherry-picking commit 59a76d3.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .goreleaser.yaml
	modified:   Makefile
	modified:   README.md

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   .github/workflows/ci-release.yml

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

## Overview

**UPDATE**

This PR adds building binaries to the release process by using
[goreleaser](https://goreleaser.com/).

The CI release process is largely unchanged. Releases can be trigger by
either manually triggering the `ci_release` workflow, or they can be
triggered by pushing a version tag.

I know the team has not been using the CI to generate releases, so I
added a `make goreleaser-release` command to build the linux distro
binaries for the release locally so that they can be manually uploaded.

Result of running `make goreleaser-release`:
```
tree build
build
└── goreleaser
    ├── CHANGELOG.md
    ├── artifacts.json
    ├── celestia-app_Linux_x86_64.tar.gz
    ├── celestia-app_linux_amd64_v1
    │   └── celestia-appd
    ├── checksums.txt
    ├── config.yaml
    └── metadata.json
```

Since we are just building for `linux amd64`, I hard coded the `ledger`
build tag to simplify the changes.

The `.goreleaser.yaml` file is 90% stock generated from `goreleaser
init`. The celestia app specific items are:
```yaml
builds:
  - main: ./cmd/celestia-appd
    binary: celestia-appd
    env:
      - SDKPath={{ "github.com/cosmos/cosmos-sdk/version" }}
    goarch:
      - amd64
    goos:
      - linux
    tags:
      - ledger
    ldflags:
      # Ref: https://goreleaser.com/customization/templates/#common-fields
      #
      # .FullCommit is git commit hash goreleaser is using for the release
      #
      # .Version is the version being released
      - -X "{{ .Env.SDKPath }}.Name=celestia-app"
      - -X "{{ .Env.SDKPath }}.AppName=celestia-appd"
      - -X "{{ .Env.SDKPath }}.Version={{ .Version }}"
      - -X "{{ .Env.SDKPath }}.Commit={{ .FullCommit }}"
dist: ./build/goreleaser
```

For building locally, i added a `make goreleaser-build` command. The
binaries are put into a `build/goreleaser` directory. The `make
goreleaser` command lists the `goreleaser` commands and also checks the
version as a way to verify you have `goreleaser` installed.

Result of running `make goreleaser-build`:
```
tree build
build
└── goreleaser
    ├── artifacts.json
    ├── celestia-app_darwin_amd64_v1
    │   └── celestia-appd
    ├── config.yaml
    └── metadata.json
```

Successful github action run:
https://github.com/MSevey/celestia-app/actions/runs/6115034436/job/16597834241
Example release generated:
https://github.com/MSevey/celestia-app/releases

Created #2445 as a follow up discussion how to add signing.

---------

Co-authored-by: Rootul P <rootulp@gmail.com>
(cherry picked from commit 59a76d3)

# Conflicts:
#	.github/workflows/ci-release.yml
@mergify mergify bot added the conflicts label Sep 11, 2023
@celestia-bot celestia-bot requested a review from a team September 11, 2023 12:45
@github-actions github-actions bot added the bot item was created by a bot label Sep 11, 2023
@rootulp rootulp removed the conflicts label Sep 11, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #2463 (5d86b96) into v1.x (6a398ed) will decrease coverage by 0.04%.
Report is 1 commits behind head on v1.x.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             v1.x    #2463      +/-   ##
==========================================
- Coverage   20.52%   20.49%   -0.04%     
==========================================
  Files         138      138              
  Lines       15761    15788      +27     
==========================================
  Hits         3235     3235              
- Misses      12219    12246      +27     
  Partials      307      307              
Files Changed Coverage Δ
app/prepare_proposal.go 0.00% <0.00%> (ø)
test/util/testnode/config.go 0.00% <0.00%> (ø)

@rootulp rootulp enabled auto-merge (squash) September 13, 2023 15:19
@rootulp rootulp merged commit 79f9447 into v1.x Sep 13, 2023
22 checks passed
@rootulp rootulp deleted the mergify/bp/v1.x/pr-2437 branch September 13, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot item was created by a bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants