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

Goreleaser #2661

Merged
merged 11 commits into from
Sep 13, 2023
Merged

Goreleaser #2661

merged 11 commits into from
Sep 13, 2023

Conversation

MSevey
Copy link
Member

@MSevey MSevey commented Sep 6, 2023

Overview

UPDATE

This PR adds building binaries to the release process by using goreleaser.

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.

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

Result of running make goreleaser-release:

build
└── goreleaser
    ├── artifacts.json
    ├── celestia-node_Darwin_arm64.tar.gz
    ├── celestia-node_Darwin_x86_64.tar.gz
    ├── celestia-node_Linux_arm64.tar.gz
    ├── celestia-node_Linux_x86_64.tar.gz
    ├── celestia-node_darwin_amd64_v1
    │   └── celestia
    ├── celestia-node_darwin_arm64
    │   └── celestia
    ├── celestia-node_linux_amd64_v1
    │   └── celestia
    ├── celestia-node_linux_arm64
    │   └── celestia
    ├── checksums.txt
    ├── config.yaml
    └── metadata.json

The .goreleaser.yaml file is 90% stock generated from goreleaser init. The celestia node specific items are:

builds:
  - main: ./cmd/celestia
    binary: celestia
    env:
      # NOTE: goreleaser doesn't fully support CGO natively. If CGO is needed
      # for any node features, this should be removed and a workaround might
      # need to be created.
      # REF: https://goreleaser.com/limitations/cgo/
      - CGO_ENABLED=0
      - VersioningPath={{ "github.com/celestiaorg/celestia-node/nodebuilder/node" }}
    goos:
      - linux
      - darwin
    goarch:
      - amd64
      - arm64
    ldflags:
      # Ref: https://goreleaser.com/customization/templates/#common-fields
      #
      # .CommitDate is used to help with reproducible builds, ensuring that the
      # same date is always used
      #
      # .FullCommit is git commit hash goreleaser is using for the release
      #
      # .Version is the version being released
      - -X "{{ .Env.VersioningPath }}.buildTime={{ .CommitDate }}"
      - -X "{{ .Env.VersioningPath }}.lastCommit={{ .FullCommit }}"
      - -X "{{ .Env.VersioningPath }}.semanticVersion={{ .Version }}"
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:

build
└── goreleaser
    ├── artifacts.json
    ├── celestia-node_darwin_amd64_v1
    │   └── celestia
    ├── config.yaml
    └── metadata.json

Successful github action run: https://github.com/MSevey/celestia-node/actions/runs/6123729144/job/16622244813
Example release generated: https://github.com/MSevey/celestia-node/releases

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

@MSevey MSevey added the kind:ci CI related PRs label Sep 6, 2023
@MSevey MSevey self-assigned this Sep 6, 2023
@github-actions github-actions bot added the external Issues created by non node team members label Sep 6, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2023

Codecov Report

Merging #2661 (9fe3c46) into main (c650453) will decrease coverage by 0.14%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2661      +/-   ##
==========================================
- Coverage   51.35%   51.22%   -0.14%     
==========================================
  Files         159      159              
  Lines       10698    10698              
==========================================
- Hits         5494     5480      -14     
- Misses       4725     4738      +13     
- Partials      479      480       +1     

see 7 files with indirect coverage changes

.goreleaser.yaml Outdated Show resolved Hide resolved
@MSevey MSevey requested a review from liamsi September 8, 2023 16:08
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter still failing. otherwise, lgtm

Wondertan
Wondertan previously approved these changes Sep 11, 2023
.goreleaser.yaml Show resolved Hide resolved
.github/workflows/ci_release.yml Show resolved Hide resolved
Wondertan
Wondertan previously approved these changes Sep 11, 2023
@Wondertan
Copy link
Member

A wild conflict arises

@ramin
Copy link
Contributor

ramin commented Sep 13, 2023

@MSevey resolved the conflict, can you give it a glance and verify it's still looking good? Then let's do it

@MSevey MSevey enabled auto-merge (squash) September 13, 2023 12:28
@MSevey
Copy link
Member Author

MSevey commented Sep 13, 2023

@MSevey resolved the conflict, can you give it a glance and verify it's still looking good? Then let's do it

Thanks @ramin looks good 👍

Waiting for CI to pass

@MSevey MSevey merged commit 25ac002 into celestiaorg:main Sep 13, 2023
13 of 15 checks passed
vgonkivs pushed a commit to vgonkivs/celestia-node that referenced this pull request Oct 5, 2023
## 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.

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

Result of running `make goreleaser-release`:
```
build
└── goreleaser
    ├── artifacts.json
    ├── celestia-node_Darwin_arm64.tar.gz
    ├── celestia-node_Darwin_x86_64.tar.gz
    ├── celestia-node_Linux_arm64.tar.gz
    ├── celestia-node_Linux_x86_64.tar.gz
    ├── celestia-node_darwin_amd64_v1
    │   └── celestia
    ├── celestia-node_darwin_arm64
    │   └── celestia
    ├── celestia-node_linux_amd64_v1
    │   └── celestia
    ├── celestia-node_linux_arm64
    │   └── celestia
    ├── checksums.txt
    ├── config.yaml
    └── metadata.json
```

The `.goreleaser.yaml` file is 90% stock generated from `goreleaser
init`. The celestia node specific items are:
```yaml
builds:
  - main: ./cmd/celestia
    binary: celestia
    env:
      # NOTE: goreleaser doesn't fully support CGO natively. If CGO is needed
      # for any node features, this should be removed and a workaround might
      # need to be created.
      # REF: https://goreleaser.com/limitations/cgo/
      - CGO_ENABLED=0
      - VersioningPath={{ "github.com/celestiaorg/celestia-node/nodebuilder/node" }}
    goos:
      - linux
      - darwin
    goarch:
      - amd64
      - arm64
    ldflags:
      # Ref: https://goreleaser.com/customization/templates/#common-fields
      #
      # .CommitDate is used to help with reproducible builds, ensuring that the
      # same date is always used
      #
      # .FullCommit is git commit hash goreleaser is using for the release
      #
      # .Version is the version being released
      - -X "{{ .Env.VersioningPath }}.buildTime={{ .CommitDate }}"
      - -X "{{ .Env.VersioningPath }}.lastCommit={{ .FullCommit }}"
      - -X "{{ .Env.VersioningPath }}.semanticVersion={{ .Version }}"
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`:
```         
build
└── goreleaser
    ├── artifacts.json
    ├── celestia-node_darwin_amd64_v1
    │   └── celestia
    ├── config.yaml
    └── metadata.json
```

Successful github action run:
https://github.com/MSevey/celestia-node/actions/runs/6123729144/job/16622244813
Example release generated:
https://github.com/MSevey/celestia-node/releases

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

---------

Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
Co-authored-by: ramin <raminkeene@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues created by non node team members kind:ci CI related PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants