Skip to content

Commit 3b7c640

Browse files
committed
first commit
0 parents  commit 3b7c640

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3042
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
2+
v ✰ Thanks for creating a PR! ✰
3+
v Before smashing the submit button please review the checkboxes.
4+
v If a checkbox is n/a - please still include it but + a little note why
5+
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
6+
7+
Closes: #XXX
8+
9+
## Description
10+
11+
<!-- Add a description of the changes that this PR introduces and the files that
12+
are the most critical to review.
13+
-->
14+
15+
______
16+
17+
For contributor use:
18+
19+
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
20+
- [ ] Wrote unit
21+
- [ ] Updated relevant documentation (`docs/`)
22+
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
23+
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
24+
- [ ] Re-reviewed `Files changed` in the Github PR explorer
25+
26+
______
27+
28+
For admin use:
29+
30+
- [ ] Added appropriate labels to PR (ex. `WIP`, `R4R`, `docs`, etc)
31+
- [ ] Reviewers assigned
32+
- [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]"

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- dev
7+
8+
jobs:
9+
cleanup-runs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: rokroskar/workflow-run-cleanup-action@master
13+
env:
14+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
15+
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
16+
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-go@v4
22+
with:
23+
go-version: 1.21
24+
check-latest: true
25+
- uses: technote-space/[email protected]
26+
id: git_diff
27+
with:
28+
PATTERNS: |
29+
**/**.go
30+
go.mod
31+
go.sum
32+
- run: |
33+
make build
34+
if: env.GIT_DIFF

.github/workflows/docker-build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build docker images
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "dev"
8+
tags:
9+
- "v*.*.*"
10+
pull_request:
11+
branches:
12+
- "main"
13+
- "dev"
14+
15+
jobs:
16+
docker:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
-
23+
name: Checkout
24+
uses: actions/checkout@v4
25+
-
26+
name: Git fetch everything
27+
run: git fetch --prune --unshallow
28+
-
29+
name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
# list of Docker images to use as base name for tags
34+
images: |
35+
ghcr.io/${{ github.repository }}
36+
37+
# generate Docker tags based on the following events/attributes
38+
tags: |
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=semver,pattern={{version}}
42+
type=sha
43+
-
44+
name: Set up QEMU
45+
uses: docker/setup-qemu-action@v3
46+
-
47+
name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
-
50+
name: Login to GHCR
51+
if: github.event_name != 'pull_request'
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.repository_owner }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
-
58+
name: Build and push
59+
uses: docker/build-push-action@v5
60+
with:
61+
context: .
62+
push: ${{ github.event_name != 'pull_request' }}
63+
platforms: linux/amd64, linux/arm64
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/lint.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Lint
2+
# Lint runs golangci-lint over the entire ethermint repository This workflow is
3+
# run on every pull request and push to main The `golangci` will pass without
4+
# running if no *.{go, mod, sum} files have been changed.
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- main
10+
- dev
11+
jobs:
12+
golangci:
13+
name: Run golangci-lint
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
steps:
17+
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
18+
- uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.21
21+
check-latest: true
22+
- uses: actions/checkout@v3
23+
- uses: technote-space/[email protected]
24+
with:
25+
PATTERNS: |
26+
**/**.go
27+
go.mod
28+
go.sum
29+
- uses: golangci/[email protected]
30+
with:
31+
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
32+
version: latest
33+
args: --timeout 10m
34+
github-token: ${{ secrets.github_token }}
35+
# Check only if there are differences in the source code
36+
if: env.GIT_DIFF
37+
markdown-lint:
38+
name: Run markdown-lint
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 10
41+
steps:
42+
- uses: actions/checkout@v3
43+
- uses: technote-space/[email protected]
44+
with:
45+
PATTERNS: |
46+
docs/**/*.md
47+
README.md
48+
- uses: nosborn/[email protected]
49+
with:
50+
files: .
51+
config_file: .markdownlint.yml
52+
ignore_path: .markdownlintignore
53+
# Check only if there are differences in the source code
54+
if: env.GIT_DIFF

.github/workflows/markdown-links.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check Markdown links
2+
on:
3+
pull_request:
4+
paths:
5+
- '**.md'
6+
push:
7+
branches:
8+
- main
9+
- dev
10+
paths:
11+
- '**.md'
12+
13+
jobs:
14+
markdown-link-check:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [ 20.x ]
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: technote-space/[email protected]
22+
id: git_diff
23+
with:
24+
PATTERNS: |
25+
**/**.md
26+
- uses: gaurav-nelson/github-action-markdown-link-check@master
27+
with:
28+
folder-path: "docs"
29+
check-modified-files-only: "yes"
30+
use-quiet-mode: "yes"
31+
base-branch: "dev"
32+
node-version: ${{ matrix.node-version }}
33+
if: env.GIT_DIFF

.github/workflows/proto.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Protobuf
2+
# Protobuf runs buf (https://buf.build/) lint and check-breakage
3+
# This workflow is only run when a .proto file has been changed
4+
on:
5+
pull_request:
6+
paths:
7+
- "proto/**"
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: bufbuild/[email protected]
16+
- uses: bufbuild/buf-lint-action@v1
17+
with:
18+
input: "proto"
19+
20+
break-check:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: bufbuild/[email protected]
25+
- uses: bufbuild/buf-breaking-action@v1
26+
with:
27+
input: "proto"
28+
against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto"

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
go.work.sum
23+
.idea
24+
.DS_Store
25+
deploy/pg-data
26+
mysql1
27+
meili_data
28+
postgres
29+
mysql
30+

.gitlab-ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
stages:
2+
- build
3+
- deploy
4+
5+
build-image-dev:
6+
stage: build
7+
tags: [ ikey-shell ]
8+
only:
9+
- develop
10+
script:
11+
- GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/main main.go
12+
- docker buildx build -f Dockerfile.slim -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:dev --push .
13+
14+
build-image-prod:
15+
stage: build
16+
tags: [ ikey-shell ]
17+
only:
18+
- tags
19+
script:
20+
- GIT_TERMINAL_PROMPT=1 GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/main main.go
21+
- docker buildx build -f Dockerfile.slim -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:${CI_COMMIT_TAG} --push .
22+
23+
24+
deploy-to-dev:
25+
stage: deploy
26+
tags: [ ikey-shell ]
27+
only:
28+
- develop
29+
dependencies:
30+
- build-image-dev
31+
before_script:
32+
- git config --global user.email "[email protected]"
33+
- git config --global user.name "GitLab CI/CD"
34+
script:
35+
- git clone -b main ${GIT_SSH_REPO}
36+
- cd argocd && sed -i "s/gitTag:.*/gitTag:\ '$CI_COMMIT_SHORT_SHA'/g" $PROJECT/dev-values.yaml
37+
- git commit -am "update image tag to $CI_COMMIT_SHORT_SHA"
38+
- git push origin main
39+
40+
deploy-to-prod:
41+
stage: deploy
42+
tags: [ ikey-shell ]
43+
only:
44+
- tags
45+
dependencies:
46+
- build-image-prod
47+
before_script:
48+
- git config --global user.email "[email protected]"
49+
- git config --global user.name "GitLab CI/CD"
50+
script:
51+
- git clone -b main ${GIT_SSH_REPO}
52+
- cd argocd && sed -i "s/tag:.*/tag:\ '$CI_COMMIT_TAG'/g" $PROJECT/prod-values.yaml
53+
- git commit -am "update image tag to $CI_COMMIT_TAG"
54+
- git push origin main

0 commit comments

Comments
 (0)