Skip to content

Commit

Permalink
Merge branch 'main' into hlib/adr-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin authored Feb 26, 2024
2 parents 9afb2eb + 1a20776 commit 3bde8cc
Show file tree
Hide file tree
Showing 579 changed files with 46,714 additions and 17,530 deletions.
38 changes: 38 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

set -eu -o pipefail

STAGED_GO_FILES=$(git diff --cached --name-only -- '*.go')
STAGED_MD_FILES=$(git diff --cached --name-only -- '*.md')

if [[ $STAGED_GO_FILES == "" ]] && [[ $STAGED_MD_FILES == "" ]]; then
echo "--> Found no go or markdown files, skipping linting"
elif [[ $STAGED_GO_FILES == "" ]]; then
echo "--> Found markdown files, linting"
if ! command -v markdownlint &> /dev/null ; then
echo "markdownlint is not installed of available in the PATH" >&2
echo "please check https://github.com/igorshubovych/markdownlint-cli" >&2
exit 1
fi
markdownlint --config .markdownlint.yaml '**/*.md'
else
echo "--> Found go files, running make lint"
if ! command -v golangci-lint &> /dev/null ; then
echo "golangci-lint not installed or available in the PATH" >&2
echo "please check https://github.com/golangci/golangci-lint" >&2
exit 1
fi
make lint
fi

if go mod tidy -v 2>&1 | grep -q 'updates to go.mod needed'; then
exit 1
fi

git diff --exit-code go.* &> /dev/null

if [ $? -eq 1 ]; then
echo "go.mod or go.sum differs, please re-add it to your commit"

exit 1
fi
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
# global owners are only requested if there isn't a more specific
# codeowner specified below. For this reason, the global codeowners
# are often repeated in package-level definitions.
* @liamsi @renaynay @Wondertan @vgonkivs @distractedm1nd
* @renaynay @Wondertan @vgonkivs @distractedm1nd @walldiss @ramin

docs/adr @adlerjohn @liamsi
48 changes: 23 additions & 25 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Bug Report
description: File a bug report to inform the community on your awesome finding!
labels: ["bug",]
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thank you for filling out this bug report!
- type: input
id: version
attributes:
attributes:
label: Celestia Node version
description: use 'celestia version' or 'git rev-parse --verify HEAD' if installed from source code
description: >
use 'celestia version' or 'git rev-parse --verify HEAD' if installed
from source code
validations:
required: true
- type: markdown
attributes:
attributes:
value: |
Environment
- type: input
Expand All @@ -33,52 +35,48 @@ body:
id: others
attributes:
label: Others
description: e.g. flag options, celestia config file changes, resources limitation(like cpu, ram limit, swap etc.)
description: >
e.g. flag options, celestia config file changes, resources
limitation(like cpu, ram limit, swap etc.)
- type: textarea
id: steps
attributes:
label: Steps to reproduce it
description: What steps have you made to reproduce it?
description: What steps have you made to reproduce it?
placeholder: Tell us what you see!
value:
validations:
required: true
- type: textarea
id: expectation
attributes:
label: Expected result
description: What do you expect to happen as a final result?
description: What do you expect to happen as a final result?
placeholder: Let us know what is expected
value:
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual result
description: What do you see happened instead as a final result?
placeholder: This is the crucial part in detecting the root cause of the issue
value:
description: What do you see happened instead as a final result?
placeholder: >
This is the crucial part in detecting the root cause of the issue
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log(max 20 lines) output. This will be automatically formatted into code, so no need for backticks. Or paste gists, pastebins links here
render: shell
description: >
Please copy and paste any relevant log(max 20 lines) output. This will
be automatically formatted into code, so no need for backticks. Or paste
gists, pastebins links here
render: Shell
- type: textarea
id: misc
attributes:
label: Notes
description: Is there anything else we need to know?
placeholder: Maybe, you have other ways to repro or what side effects there are if changing steps
#75
# - type: checkboxes
# id: terms
# attributes:
# label: Code of Conduct
# description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com)
# options:
# - label: I agree to follow this project's Code of Conduct
# required: true
description: Is there anything else we need to know?
placeholder: >
Maybe, you have other ways to repro or what side effects there are if
changing steps
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Feature Request
description: Request a new feature to inform the community on what will be benenificial for the project!
description: >
Request a new feature to inform the community on what will be beneficial for
the project!
title: "[Feature Request]: "
labels: ["enhancement",]
labels: ["enhancement"]
body:
- type: markdown
attributes:
Expand Down
20 changes: 19 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ updates:
day: monday
time: "11:00"
open-pull-requests-limit: 10
labels:
- kind:deps
- package-ecosystem: gomod
directory: "/"
schedule:
Expand All @@ -18,4 +20,20 @@ updates:
- Wondertan
- renaynay
labels:
- kind:dependencies
- kind:deps
ignore:
- dependency-name: "*otel*"
update-types: ["version-update:semver-patch"]
groups:
otel:
patterns:
- "go.opentelemetry.io/otel*"
- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
day: monday
time: "11:00"
open-pull-requests-limit: 10
labels:
- kind:deps
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
Thank you for submitting a pull request!
Please make sure you have reviewed our contributors guide before submitting your
first PR.
Please ensure you've addressed or included references to any related issues.
Tips:
- Use keywords like "closes" or "fixes" followed by an issue number to automatically close related issues when the PR is merged (e.g., "closes #123" or "fixes #123").
- Describe the changes made in the PR.
- Ensure the PR has one of the required tags (kind:fix, kind:misc, kind:break!, kind:refactor, kind:feat, kind:deps, kind:docs, kind:ci, kind:chore, kind:testing)
-->
140 changes: 140 additions & 0 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: CI and Release
on:
merge_group:
push:
branches:
- main
# Trigger on version tags
tags:
- "v*"
pull_request:
workflow_dispatch:
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Semver type of new version (major / minor / patch)"
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major

jobs:
# set up go version for use through pipelines, setting
# variable one time and setting outputs to access passing it
# to other jobs
setup:
runs-on: ubuntu-latest
env:
# upgrade go version throughout pipeline here
GO_VERSION: "1.21"
outputs:
go-version: ${{ steps.set-vars.outputs.go-version }}
branch: ${{ steps.trim_ref.outputs.branch }}
debug: ${{ steps.debug.outputs.debug }}
steps:
- name: Set go version
id: set-vars
run: echo "go-version=${{env.GO_VERSION}}" >> "$GITHUB_OUTPUT"

- name: Trim branch name
id: trim_ref
run: |
echo "branch=$(${${{ github.ref }}:11})" >> $GITHUB_OUTPUT
- name: Set debug output
id: debug
run: |
if [[ "${{ runner.debug }}" == "true" ]]; then
echo "debug=true" >> $GITHUB_ENV
else
echo "debug=false" >> $GITHUB_ENV
fi
# Dockerfile Linting
hadolint:
uses: celestiaorg/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
with:
dockerfile: Dockerfile

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: celestiaorg/.github/.github/actions/[email protected]

markdown-lint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: |
npm install -g [email protected]
markdownlint --config .markdownlint.yaml '**/*.md'
go-ci:
needs: setup
uses: ./.github/workflows/go-ci.yml
with:
go-version: ${{ needs.setup.outputs.go-version }}

# If this was a workflow dispatch event, we need to generate and push a tag
# for goreleaser to grab
version_bump:
needs: [hadolint, yamllint, markdown-lint, go-ci]
runs-on: ubuntu-latest
permissions: "write-all"
steps:
- uses: actions/checkout@v4

- name: Bump version and push tag
# Placing the if condition here is a workaround for needing to block
# on this step during workflow dispatch events but the step not
# needing to run on tags. If we had the if condition on the full
# version_bump section, it would skip and not run, which would result
# in goreleaser not running either.
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: ${{ inputs.version }}
release_branches: ${{ needs.setup.outputs.branch }}

# Generate the release with goreleaser to include pre-built binaries
goreleaser:
needs: version_bump
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
permissions: "write-all"
steps:
- uses: actions/checkout@v4

- run: git fetch --force --tags

- uses: actions/setup-go@v5
with:
go-version: ${{ needs.setup.outputs.go-version }}

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

# Generate the binaries and release
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
23 changes: 23 additions & 0 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker Build & Publish

# Trigger on all push events, new semantic version tags, and all PRs
on:
merge_group:
push:
branches:
- "main"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
pull_request:

jobs:
docker-security-build:
permissions:
contents: write
packages: write
uses: celestiaorg/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
with:
dockerfile: Dockerfile
Loading

0 comments on commit 3bde8cc

Please sign in to comment.