Skip to content

Commit

Permalink
chore!: add ci workflows (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored Jan 6, 2024
1 parent 0b49c5a commit 79d147e
Show file tree
Hide file tree
Showing 18 changed files with 392 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CODEOWNERS: <https://help.github.com/articles/about-codeowners/>

# Everything goes through the following "global owners" by default. Unless a later
# match takes precedence, the "global owners" will be requested for review when
# someone opens a PR. Note that the last matching pattern takes precedence, so
# global owners are only requested if there isn't a more specific codeowner
# specified below. For this reason, the global owners are often repeated in
# directory-level definitions.

# global owners
* @celestiaorg/celestia-core @celestiaorg/celestia-node
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Bug Report
description: Create a report to help us squash bugs!
title: "<title>"
labels: ["bug"]

body:
- type: markdown
attributes:
value: |
IMPORTANT: Prior to opening a bug report, check if it affects one of the
core modules and if it's eligible for a bug bounty on `SECURITY.md`.
Bugs that are not submitted through the appropriate channels won't
receive any bounty.
- type: textarea
id: summary
attributes:
label: Summary of Bug
description: Concisely describe the issue.
validations:
required: true

- type: textarea
id: version
attributes:
label: Version
description: git commit hash or release version
validations:
required: true

- type: textarea
id: repro
attributes:
label: Steps to Reproduce
description: >
What commands in order should someone run to reproduce your problem?
validations:
required: true

- type: checkboxes
id: admin
attributes:
label: For Admin Use
description: (do not edit)
options:
- label: Not duplicate issue
- label: Appropriate labels applied
- label: Appropriate contributors tagged
- label: Contributor assigned/self-assigned
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Feature Request
description: Create a proposal to request a feature
title: "<title>"
labels: ["enhancement"]

body:
- type: markdown
attributes:
value: |
✰ Thanks for opening an issue! ✰
Before smashing the submit button please fill in the template.
Word of caution: poorly thought-out proposals may be rejected without
deliberation.
- type: textarea
id: summary
attributes:
label: Summary
description: Short, concise description of the proposed feature.
validations:
required: true

- type: textarea
id: problem
attributes:
label: Problem Definition
description: |
Why do we need this feature?
What problems may be addressed by introducing this feature?
What benefits does the SDK stand to gain by including this feature?
Are there any disadvantages of including this feature?
validations:
required: true

- type: textarea
id: proposal
attributes:
label: Proposal
description: Detailed description of requirements of implementation.
validations:
required: true

- type: checkboxes
id: admin
attributes:
label: For Admin Use
description: (do not edit)
options:
- label: Not duplicate issue
- label: Appropriate labels applied
- label: Appropriate contributors tagged
- label: Contributor assigned/self-assigned
19 changes: 19 additions & 0 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# More info at https://github.com/necojackarc/auto-request-review
reviewers:
# The default reviewers
defaults:
# Example of Github Team. Github team must have write access to repo.
# NOTE: This assigned the team itself, not members of the team. The Github
# team auto PR assignment will then turn this into individuals
- team:celestia-core
- team:celestia-node

options:
ignore_draft: true
ignored_keywords:
- DO NOT REVIEW
enable_group_assignment: false

# Randomly pick reviewers up to this number.
# Do not set this option if you'd like to assign all matching reviewers.
number_of_reviewers: 2
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependencies
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependencies
25 changes: 25 additions & 0 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci-release

# Run this workflow on push events (i.e. PR merge) to main or release branches,
# push events for new semantic version tags, and all PRs.
on:
push:
branches:
- main
- "v[0-9]+.x"
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:
lint:
uses: ./.github/workflows/lint.yml

markdown-linter:
uses: ./.github/workflows/markdown-linter.yml

test:
uses: ./.github/workflows/test.yml
50 changes: 50 additions & 0 deletions .github/workflows/issue-label-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: issue-label-automation
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
jobs:
automate-labels:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
env:
IS_BOT: ${{ (github.actor == 'dependabot[bot]' || github.actor == 'mergify[bot]') }}
IS_HUMAN: ${{ !(github.actor == 'dependabot[bot]' || github.actor == 'mergify[bot]') }}
steps:
- name: Check if issue or PR was created by external contributor
if: env.IS_HUMAN == 'true' && github.repository_owner == 'celestiaorg'
uses: tspascoal/get-user-teams-membership@v3
id: teamCheck
with:
username: ${{ github.actor }}
team: "celestia-core"
GITHUB_TOKEN: ${{ secrets.PAT_TEAM_CHECK }}

# If an issue was unlabeled add `needs:triage`.
- name: Maybe label issue with `needs:triage`
if: ${{ github.event_name == 'issues' }}
uses: andymckay/labeler@master
with:
add-labels: "needs:triage"
ignore-if-labeled: true
repo-token: ${{ secrets.GITHUB_TOKEN }}

# If an issue or PR was created by someone that isn't part of
# celestia-core, add the `external` label.
- name: Maybe label issue or PR with `external`
if: env.IS_HUMAN == 'true' && steps.teamCheck.outputs.isTeamMember == 'false'
uses: andymckay/labeler@master
with:
add-labels: "external"
repo-token: ${{ secrets.GITHUB_TOKEN }}

# If a PR was created by dependabot or mergify add the `bot` label.
- name: Maybe label PR with `bot`
if: env.IS_BOT == 'true'
uses: andymckay/labeler@master
with:
add-labels: "bot"
repo-token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/lint-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint-pull-request

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

permissions:
pull-requests: read

jobs:
main:
name: conventional-commit-pr-title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: lint
on:
workflow_call:

env:
GO_VERSION: '1.21.1'

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: technote-space/[email protected]
with:
# This job will pass without running if go.mod, go.sum, and *.go
# wasn't modified.
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: golangci/[email protected]
with:
version: v1.55.2
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: celestiaorg/.github/.github/actions/[email protected]
23 changes: 23 additions & 0 deletions .github/workflows/markdown-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: markdown-linter
on:
workflow_call:

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install markdownlint-cli
run: npm install -g [email protected]
shell: bash

- name: Run markdownlint
run: markdownlint --config .markdownlint.yaml **/*.md
shell: bash
23 changes: 23 additions & 0 deletions .github/workflows/pr-review-requester.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: pr-review-requester

on:
# pull_request_target is used to allow forks write permissions when running
# this workflow. With the pull_request trigger, forks do not have any write
# access for security reasons, however write access is needed in order to
# request reviews. Since this workflow is simply requesting reviewers, it is
# safe to allow forks write access.
pull_request_target:

jobs:
auto-request-review:
name: Auto request reviews
uses: celestiaorg/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
secrets: inherit
# write access for issues and pull requests is needed because the called
# workflow requires write access to issues and pull requests and the
# permissions must match
permissions:
issues: write
pull-requests: write
with:
run-auto-request-review: true
14 changes: 14 additions & 0 deletions .github/workflows/project-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: project-automation
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add new issues to the core/app project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/celestiaorg/projects/24
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test
on:
workflow_call:

env:
GO_VERSION: '1.21.1'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Run tests
run: go test ./... -v -timeout 5m -race
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
run:
timeout: 5m
modules-download-mode: readonly

linters:
enable:
- exportloopref
- gofumpt
- misspell
- nakedret
- revive
- prealloc
- stylecheck

linters-settings:
nakedret:
# Ban the use of naked returns because they reduce code readability.
max-func-lines: 0 # override the default: 30
5 changes: 5 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"default": true # Default state for all rules
"MD010":
"code_blocks": false # Disable rule for hard tabs in code blocks
"MD013": false # Disable rule for line length
"MD033": false # Disable rule banning inline HTML
Loading

0 comments on commit 79d147e

Please sign in to comment.