generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from okp4/feat/initial-implementation
Implement Minimum Viable Blockchain
- Loading branch information
Showing
29 changed files
with
23,683 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
target/ | ||
.github/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: "daily" | ||
reviewers: | ||
- "maintainers" | ||
interval: daily | ||
open-pull-requests-limit: 2 | ||
- package-ecosystem: gomod | ||
directory: / | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 5 | ||
- package-ecosystem: docker | ||
directory: / | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
|
||
push: | ||
branches: [ main ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build-go: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Go environment | ||
uses: actions/[email protected] | ||
with: | ||
go-version: "1.17.6" | ||
|
||
- name: Build go project | ||
run: | | ||
make build | ||
build-docker: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build docker image | ||
run: | | ||
docker build . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: Lint | ||
|
||
on: | ||
workflow_call: | ||
|
||
push: | ||
branches: [ main ] | ||
|
||
|
@@ -40,3 +42,30 @@ jobs: | |
|
||
- name: Lint yaml files | ||
uses: ibiqlik/[email protected] | ||
|
||
lint-go: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint go code (golangci-lint) | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.44 | ||
|
||
lint-dockerfile: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint dockerfile (hadolint) | ||
uses: hadolint/[email protected] | ||
|
||
- name: Lint dockerfile (docker-lint) | ||
uses: luke142367/[email protected] | ||
with: | ||
target: Dockerfile | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ 'v*' ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-docker-images: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker registry | ||
run: | | ||
echo ${{ secrets.DOCKER_REGISTRY_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_REGISTRY_ID }} --password-stdin | ||
- name: Set up context | ||
id: project_context | ||
uses: FranzDiebold/[email protected] | ||
|
||
- name: Set up versions | ||
id: project_version | ||
run: | | ||
version=`head -n 1 version` | ||
echo "::set-output name=version::$version" | ||
echo "::set-output name=major::$(echo $version | cut -d. -f1)" | ||
echo "::set-output name=minor::$(echo $version | cut -d. -f2)" | ||
echo "::set-output name=revision::$(echo $version | cut -d. -f3)" | ||
echo "::set-output name=image::$GITHUB_REPOSITORY" | ||
- name: Build and publish image(s) | ||
run: | | ||
if [[ $GITHUB_REF == refs/tags/v* ]]; then | ||
echo "Publish docker image for branch" | ||
docker build \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:${{ steps.project_version.outputs.major }} \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:${{ steps.project_version.outputs.major }}.${{ steps.project_version.outputs.minor }} \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:${{ steps.project_version.outputs.version }} \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:latest \ | ||
. | ||
elif [[ $GITHUB_EVENT_NAME == pull_request ]]; then | ||
echo "Publish docker image for branch" | ||
docker build \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:$CI_ACTION_REF_NAME_SLUG \ | ||
. | ||
else | ||
echo "Publish docker image for nightly" | ||
docker build \ | ||
-t ghcr.io/${{ steps.project_version.outputs.image }}:nightly \ | ||
. | ||
fi | ||
docker push ghcr.io/${{ steps.project_version.outputs.image }} --all-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik' | ||
uses: ./.github/workflows/lint.yaml | ||
|
||
build: | ||
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik' | ||
uses: ./.github/workflows/build.yaml | ||
|
||
test: | ||
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik' | ||
uses: ./.github/workflows/test.yaml | ||
|
||
perfom-release: | ||
if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik' | ||
needs: | ||
- lint | ||
- build | ||
- test | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.OKP4_TOKEN }} | ||
|
||
- name: Release project | ||
uses: cycjimmy/semantic-release-action@v2 | ||
with: | ||
semantic_version: 19.0.2 | ||
branch: main | ||
extra_plugins: | | ||
@semantic-release/changelog | ||
@semantic-release/exec | ||
@semantic-release/git | ||
@google/semantic-release-replace-plugin | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.OKP4_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
|
||
push: | ||
branches: [ main ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
test-go: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Go environment | ||
uses: actions/[email protected] | ||
with: | ||
go-version: "1.17.6" | ||
|
||
- name: Test go project | ||
run: | | ||
make test-go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
vue/ | ||
release/ | ||
target/ | ||
okp4d | ||
.idea/ | ||
.vscode/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
run: | ||
timeout: 5m | ||
linters: | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- contextcheck | ||
- cyclop | ||
- dupl | ||
- durationcheck | ||
- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- funlen | ||
- forbidigo | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- goimports | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- lll | ||
- makezero | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- noctx | ||
- nolintlint | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- stylecheck | ||
- tenv | ||
- testpackage | ||
- tparallel | ||
- unconvert | ||
- unparam | ||
- wastedassign | ||
- whitespace | ||
|
||
linters-settings: | ||
cyclop: | ||
max-complexity: 20 | ||
skip-tests: true | ||
funlen: | ||
statements: 65 | ||
godot: | ||
scope: declarations # comments to be checked: `declarations` (default), `toplevel`, or `all` | ||
exclude: | ||
- "this line is used by starport scaffolding .*" | ||
lll: | ||
line-length: 135 | ||
output: | ||
uniq-by-line: false | ||
|
||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude-rules: | ||
- source: "^//\\s*go:generate\\s" | ||
linters: | ||
- lll | ||
- source: "(noinspection|TODO)" | ||
linters: | ||
- godot | ||
- source: "//noinspection" | ||
linters: | ||
- gocritic | ||
- source: "^\\s+if _, ok := err\\.\\([^.]+\\.InternalError\\); ok {" | ||
linters: | ||
- errorlint | ||
- path: "_test\\.go" | ||
linters: | ||
- bodyclose | ||
- deadcode | ||
- dupl | ||
- funlen | ||
- goconst | ||
- noctx | ||
- unused | ||
- varcheck | ||
- wrapcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
branches: | ||
- main | ||
|
||
plugins: | ||
- "@semantic-release/commit-analyzer" | ||
- "@semantic-release/release-notes-generator" | ||
- - "@semantic-release/changelog" | ||
- changelogFile: CHANGELOG.md | ||
changelogTitle: "# ØKP4 protocol changelog" | ||
- - "@google/semantic-release-replace-plugin" | ||
- replacements: | ||
- files: [version] | ||
from: ^.+$ | ||
to: ${nextRelease.version} | ||
countMatches: true | ||
results: | ||
- file: version | ||
hasChanged: true | ||
numMatches: 1 | ||
numReplacements: 1 | ||
|
||
- "@semantic-release/github" | ||
- - "@semantic-release/git" | ||
- assets: | ||
- CHANGELOG.md | ||
- version | ||
message: "chore(release): perform release ${nextRelease.version}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
extends: default | ||
ignore: | | ||
openapi.yml | ||
rules: | ||
document-start: disable | ||
line-length: | ||
|
Oops, something went wrong.