Skip to content

Commit

Permalink
[wip] repo boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
wizeguyy committed Oct 2, 2023
1 parent 0009667 commit 7f75f7b
Show file tree
Hide file tree
Showing 18 changed files with 1,282 additions and 48 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @wizeguyy @kiltsonfire @gameofpointers
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Report a bug
about: Something with go-quai is not working as expected
title: ''
labels: 'type:bug'
assignees: ''

---

#### System information

Go-quai version: `go-quai version tag`
OS & Version: Windows/Linux/OSX
Commit hash : (if `develop`)

#### Expected behaviour


#### Actual behaviour


#### Steps to reproduce the behaviour


#### Backtrace

````
[backtrace]
````

When submitting logs: please submit them as text and not screenshots.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Request a feature
about: Report a missing feature - e.g. as a step before submitting a PR
title: ''
labels: 'type:feature'
assignees: ''

---

# Rationale

Why should this feature exist?
What are the use-cases?

# Implementation

Do you have ideas regarding the implementation of this feature?
Are you willing to implement this feature?
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Ask a question
about: Something is unclear
title: ''
labels: 'type:docs'
assignees: ''

---

This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. For general questions please use [discord](https://discord.com/invite/quai) or the Quai stack exchange at https://forum.quai.network.
136 changes: 136 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Build and Deploy sub-action
on:
workflow_call:
# Define the inputs required for the action to run
inputs:
# The environment where the deployment should occur
env:
required: true
type: string
description: The environment where the deployment should occur (e.g. dev, staging, prod).

# The awk command to update the version environment variable
awk:
required: true
type: string
description: The awk command to update the version environment variable.

# The rails command for a sanity check
rails:
required: false
type: string
default: echo "continuing."
description: The rails command for a sanity check.

# The branch where the action should be triggered
branch:
required: false
type: string
default: ${{ github.ref }}
description: The branch where the action should be triggered.

# Define the secrets required for the action to run
secrets:
# GitHub Personal Access Token for logging into GitHub
GH_PAT:
description: 'Personal Access Token (PAT) for logging into GitHub'
required: true

# Docker registry login credentials
DOCKER:
description: 'Docker registry login credentials'
required: true

# Google Cloud Platform Service Account Key for logging into the GKE cluster
GKE_SA_KEY:
description: 'Google Cloud Platform Service Account Key for logging into the GKE cluster'
required: true

# Project ID for the Google Cloud Platform project
GKE_PROJECT:
description: 'Project ID for the Google Cloud Platform project'
required: true

# Private key for signing commits and tags with GPG
GPG_PRIVATE_KEY:
description: 'Private key for signing commits and tags with GPG'
required: true

# Passphrase for using the GPG private key
GPG_PASSPHRASE:
description: 'Passphrase for using the GPG private key'
required: true
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs.env }}
steps:
# Checkout the specified branch from GitHub
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

# Import the GPG key for signing Git commits and tags
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_tag_gpgsign: true
git_commit_gpgsign: true

# Get the current version from the 'VERSION' file
- name: get Version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV

# Sanity check the version we are trying to release
- name: Sanity Check Branch
run: ${{ inputs.rails }}

# Sync the version in the 'Chart.yaml' and 'values.yaml' files
- name: Sync Chart.yaml version
run: yq eval -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml

- name: Sync values.yaml version
run: yq eval -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml
# Login to the Docker registry
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: quaibuild
password: ${{ secrets.DOCKER }}

# Build and push the Docker image to the registry
- name: Build Docker
run: docker build -t quainetwork/go-quai:${{ env.VERSION }} .

- name: Push to Docker Hub
run: docker push quainetwork/go-quai:${{ env.VERSION }}

# Tag the Git repository with the current version
- name: git tag
run: git tag -s ${{ env.VERSION }} -m ${{ env.VERSION }} && git push origin tag ${{ env.VERSION }}

# Rev the version
- name: Update version environment variable
run: echo "VERSION=$(echo $VERSION | ${{ inputs.awk }})" >> $GITHUB_ENV

# Update the 'VERSION' file to reflect the rev'd version
- name: Update VERSION file
run: echo "$VERSION" > VERSION

# Sync the version in the 'Chart.yaml' and 'values.yaml' files
- name: Update Chart.yaml version
run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml

- name: Update values.yaml version
run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml

- uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ inputs.branch }}
commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }}
commit_options: -S
commit_user_email: [email protected]
commit_user_name: ci-dominantstrategies
24 changes: 24 additions & 0 deletions .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build on PR
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: create network.env from dist
run: mv network.env.dist network.env

- name: build
run: make go-quai
96 changes: 96 additions & 0 deletions .github/workflows/cut-minor-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Cut a new Minor Release Branch
on: workflow_dispatch
jobs:
cutReleaseCandidate:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.set-branch.outputs.branch }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

# Import the GPG key for signing Git commits and tags
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_tag_gpgsign: true
git_commit_gpgsign: true

- name: get Version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV

- name: Update version environment variable
run: echo "VERSION=$(echo $VERSION | sed 's/pre/rc/g' | awk -F. '{print $1"."$2"."$3"."0}')" >> $GITHUB_ENV

- name: Update 'VERSION' file
run: echo "$VERSION" > VERSION

- name: Update Chart.yaml version
run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml

- name: Update values.yaml version
run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml

- name: Update version environment variable e.g. v0.1.0-pre.0 -> v0.1
run: echo "BRANCH=$(echo $VERSION | sed 's/\.[0-9]*-.*//g')" >> $GITHUB_ENV

- name: Store version in branch variable
id: set-branch
run: echo "::set-output name=branch::${{ env.BRANCH }}"

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }}
branch: ${{ env.BRANCH }}
create_branch: true
commit_options: -S
commit_user_email: [email protected]
commit_user_name: ci-dominantstrategies


- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

- name: get Version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV

- name: Update version environment variable
run: echo "VERSION=$(echo $VERSION | sed "s/-.*//g" | awk -F. '{print $1"."$2+1"."0"-pre.0"}')" >> $GITHUB_ENV

- name: Update 'VERSION' file
run: echo "$VERSION" > VERSION

- name: Update Chart.yaml version
run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml

- name: Update values.yaml version
run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Cut ${{ env.BRANCH }} release branch and rev'd 'VERSION' file to ${{ env.VERSION }}
branch: main
commit_options: -S
commit_user_email: [email protected]
commit_user_name: ci-dominantstrategies
deployReleaseCandidate:
uses: ./.github/workflows/build-deploy.yml
secrets:
DOCKER: ${{ secrets.DOCKER }}
GH_PAT: ${{ secrets.GH_PAT }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with:
env: quai-sandbox
awk : sed -e "s/pre/rc/g" | awk -F . '{print $1"."$2"."$3"."$4+1}'
rails: '[[ ! "$VERSION" =~ "pre" ]]'
branch: ${{ needs.cutReleaseCandidate.outputs.branch }}
needs: [cutReleaseCandidate]
15 changes: 15 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build and Deploy to Dev
on: workflow_dispatch
jobs:
buildDeployDev:
uses: ./.github/workflows/build-deploy.yml
secrets:
DOCKER: ${{ secrets.DOCKER }}
GH_PAT: ${{ secrets.GH_PAT }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with:
env: quai-dev
awk: awk -F. '{print $1"."$2"."$3"."$4+1}'
16 changes: 16 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build and Deploy to Prod
on: workflow_dispatch
jobs:
buildDeployProd:
uses: ./.github/workflows/build-deploy.yml
secrets:
DOCKER: ${{ secrets.DOCKER }}
GH_PAT: ${{ secrets.GH_PAT }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with:
env: quai-prod
awk: sed "s/-.*//g" | awk -F. '{print $1"."$2"."$3+1"-rc.0"}'
rails: '[[ ! "$VERSION" =~ "rc" ]] && [[ ! "$VERSION" =~ "pre" ]]'
16 changes: 16 additions & 0 deletions .github/workflows/deploy-sandbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build and Deploy to Sandbox
on: workflow_dispatch
jobs:
buildDeploySandbox:
uses: ./.github/workflows/build-deploy.yml
secrets:
DOCKER: ${{ secrets.DOCKER }}
GH_PAT: ${{ secrets.GH_PAT }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with:
env: quai-sandbox
awk: sed -e "s/pre/rc/g" | awk -F . '{print $1"."$2"."$3"."$4+1}'
rails: '[[ ! "$VERSION" =~ "pre" ]]'
24 changes: 24 additions & 0 deletions .github/workflows/lint-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint on PR
on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
Loading

0 comments on commit 7f75f7b

Please sign in to comment.