Skip to content

Commit

Permalink
feat: full refactor (#1)
Browse files Browse the repository at this point in the history
gex full refactor

Co-authored-by: Pantani <Pantani>
  • Loading branch information
Pantani authored Apr 15, 2024
1 parent 233d335 commit c52b47e
Show file tree
Hide file tree
Showing 44 changed files with 4,377 additions and 1,148 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# Primary repo maintainers
* @ilgooz @jeronimoalbi @Pantani @julienrbrt

# Docs
*.md @salmad3 @toschdev @ilgooz
docs/* @salmad3 @toschdev @ilgooz
changelog.md @ilgooz @salmad3 @toschdev @jeronimoalbi @Pantani @julienrbrt
33 changes: 33 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
coverage:
precision: 2
round: down
range: 70...100
status:
project:
default:
target: auto
threshold: 10%
informational: true
patch:
default:
informational: true

comment:
layout: "reach, diff, files"
behavior: default
require_changes: true

codecov:
notify:
wait_for_ci: false

ignore:
- "*.pb.go"
- "*.pb.gw.go"
- "*.md"
- "*.ts"
- "actions/"
- "assets/"
- "docs/"
- "integration/"
- "scripts/"
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
time: "10:00"
labels:
- "dependencies"
- "component:go"
- "skip-changelog"
open-pull-requests-limit: 0

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 0
18 changes: 18 additions & 0 deletions .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: auto-author-assign

on:
pull_request_target:
types: [ opened, reopened ]

permissions:
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/[email protected]
19 changes: 19 additions & 0 deletions .github/workflows/cl-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Changelog Enforcer
on:
pull_request:
# The specific activity types are listed here to include "labeled" and "unlabeled"
# (which are not included by default for the "pull_request" trigger).
# This is needed to allow skipping enforcement of the changelog in PRs with specific labels,
# as defined in the (optional) "skipLabels" property.
types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ]

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: 'changelog.md'
missingUpdateErrorMessage: 'Please add an entry to the changelog.md file or add the "skip-changelog" label'
skipLabels: 'skip-changelog'
versionPattern: ''
29 changes: 29 additions & 0 deletions .github/workflows/go-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Go formatting
on:
push:
branches: [ main ]
paths:
- '**.go'

jobs:
go-formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Run make format
run: make format

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "chore: go formatting"
commit-message: "chore: go formatting"
body: ""
branch: chore/go-formatting
16 changes: 16 additions & 0 deletions .github/workflows/janitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Janitor
# Janitor cleans up previous runs that are not completed for a given workflow
# It cancels Sims and Tests
# Reference the API https://api.github.com/repos/:org/:repo/actions/workflows to find workflow ids
on:
pull_request:

jobs:
cancel:
name: "Cancel Previous Runs"
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
38 changes: 38 additions & 0 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Binaries

on:
release:
types: [ published ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
binary:
runs-on: ubuntu-latest
env:
working-directory: go/src/github.com/ignite/gex

steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true
cache-dependency-path: go.sum

- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.working-directory }}
fetch-depth: 0

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
workdir: ${{ env.working-directory }}
version: 1.13.0
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73 changes: 73 additions & 0 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release Docker Image

on:
release:
types: [ published ]
schedule:
- cron: "0 0 * * *" # every day at midnight

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
consecutiveness:
runs-on: ubuntu-latest
steps:
- uses: ignite/consecutive-workflow-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}

check-latest-run:
runs-on: "ubuntu-latest"
steps:
- uses: octokit/[email protected]
id: check_last_run
with:
route: GET /repos/${{github.repository}}/actions/workflows/release-docker.yml/runs?per_page=1&status=completed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}

docker:
name: Push Docker image to Docker Hub
if: needs.check-latest-run.outputs.last_sha != github.sha
runs-on: ubuntu-latest
needs: [ consecutiveness, check-latest-run ]

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ignitehq/gex
# push to ignitehq/gex:latest on every push to master
# push to ignitehq/gex:vx.x.x on every release published
tags: |
type=raw,value=latest
type=semver,pattern=v{{version}}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
85 changes: 85 additions & 0 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release nightly

on:
schedule:
- cron: "0 0 * * *" # every day at midnight
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
consecutiveness:
runs-on: ubuntu-latest
steps:
- uses: ignite/consecutive-workflow-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}

check-latest-run:
runs-on: "ubuntu-latest"
steps:
- uses: octokit/[email protected]
id: check_last_run
with:
route: GET /repos/${{github.repository}}/actions/workflows/release-nightly.yml/runs?per_page=1&status=completed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}

release-nightly:
if: needs.check-latest-run.outputs.last_sha != github.sha
runs-on: ubuntu-latest
needs: [ consecutiveness, check-latest-run ]
env:
working-directory: go/src/github.com/ignite/gex

steps:
- uses: actions/checkout@v4

- name: Delete the nightly release
uses: dev-drprasad/[email protected]
with:
tag_name: nightly
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push new nightly tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: nightly
tag_prefix: ""

- name: Create the new nightly release
uses: ncipollo/release-action@v1
with:
tag: nightly
name: nightly
prerelease: true

releases-binaries:
if: needs.check-latest-run.outputs.last_sha != github.sha
name: Release Go Binary
needs: [ consecutiveness, check-latest-run ]
runs-on: ubuntu-latest
strategy:
matrix:
goos: [ linux, darwin ]
goarch: [ amd64, arm64 ]
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
project_path: "."
binary_name: "gex"
asset_name: gex-nightly-${{ matrix.goos }}-${{ matrix.goarch }}
release_name: "nightly"
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
ldflags: -s -w -X github.com/ignite/gex/version.Version=nightly
retry: 10
17 changes: 17 additions & 0 deletions .github/workflows/stats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
schedule:
# Run this once per day, towards the end of the day for keeping the most
# recent data point most meaningful (hours are interpreted in UTC).
- cron: "0 23 * * *"
workflow_dispatch: # Allow for running this manually.

jobs:
j1:
name: Gex Repository Statistics
runs-on: ubuntu-latest
steps:
- name: run-ghrs
uses: jgehrcke/[email protected]
with:
ghtoken: ${{ secrets.ghrs_github_api_token }}

Loading

0 comments on commit c52b47e

Please sign in to comment.