-
Notifications
You must be signed in to change notification settings - Fork 31
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 #11 from eolinker/V2.0
Apinto v2.0 版本完成
- Loading branch information
Showing
2,994 changed files
with
68,006 additions
and
95,844 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,90 @@ | ||
name: release | ||
#触发机制,当创建tag时 | ||
on: | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
frontend-builder: | ||
name: frontend-builder | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout #Checkout代码 | ||
uses: actions/checkout@v3 | ||
- name: Set up Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '16' | ||
- name: Yarn install | ||
run: | | ||
cd frontend && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps | ||
yarn build | ||
- name: print files | ||
run: | | ||
pwd | ||
ls -l ./ | ||
ls -l controller/ | ||
- name: upload frontend release | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: apserver-frontend | ||
path: controller/dist | ||
release: | ||
needs: [frontend-builder] | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: SetOutput #处理Tag字符串并存进outputs | ||
id: vars | ||
run: | | ||
echo "tag=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | ||
- name: Checkout #Checkout代码 | ||
uses: actions/checkout@v3 | ||
- name: download frontend release | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: apserver-frontend | ||
path: controller/dist | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.19.4' | ||
- name: Go tidy | ||
run: | | ||
go mod tidy | ||
echo "GOVERSION=$(go version)" >> $GITHUB_ENV | ||
- name: Create archives on Release #创建各种系统架构下的二进制包并上传至release assets | ||
uses: goreleaser/[email protected] | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: upload release | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: apinto-dashboard-release | ||
path: apinto-build/apserver_${{ steps.vars.outputs.tag }}_linux_amd64.tar.gz | ||
docker-push: | ||
needs: [release] | ||
name: docker-push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Login Docker #登录docker | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- name: build | ||
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} scripts/ | ||
- name: download release | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: apinto-dashboard-release | ||
path: scripts/apinto-dashboard.tar.gz | ||
- name: push image | ||
run: | | ||
docker push ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} | ||
docker tag ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:${{ steps.vars.outputs.tag }} ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:latest | ||
docker push ${{ secrets.DOCKER_USERNAME }}/apinto-dashboard:latest |
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,21 +1,61 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
/.idea/ | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
# Compiled output | ||
/tmp | ||
/out-tsc | ||
/bazel-out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
/.idea/ | ||
/vendor/ | ||
# Node | ||
/node_modules | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# IDEs and editors | ||
.idea/ | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history/* | ||
|
||
# Miscellaneous | ||
/.angular/cache | ||
.sass-cache/ | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
testem.log | ||
/typings | ||
|
||
# System files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# 单元测试 | ||
unit_coverage | ||
dist | ||
|
||
#端到端测试 | ||
e2e_coverage | ||
.nyc_output | ||
.scannerwork | ||
.vscode | ||
deploy.gitlab-ci.yml | ||
#根据后端项目组需求,暂时不上传新的angular.json文件(仓库文件中含有deployurl) | ||
/apinto-build/ | ||
/app/work | ||
/.pnpm-debug.log | ||
vender | ||
/out/ | ||
/builds/sqlite.db | ||
*.DS_Store | ||
/dist/ | ||
*.gitlab-ci.yml |
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,85 @@ | ||
variables: | ||
PATH: /opt/go/go/bin/:/opt/node/node/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin | ||
GOROOT: /opt/go/go | ||
GOPROXY: https://goproxy.cn | ||
SAVE_DIR: /opt/apinto-dashboard | ||
VERSION: $CI_COMMIT_SHORT_SHA | ||
APP: apserver | ||
APP_PRE: ${APP}_${VERSION} | ||
BUILD_DIR: apserver-build | ||
default: | ||
cache: | ||
paths: | ||
- controller/dist/ | ||
- ${BUILD_DIR} | ||
stages: | ||
- notice | ||
- build | ||
- publish | ||
- webhook | ||
feishu-informer: # 飞书回调 | ||
stage: notice | ||
variables: | ||
DIFF_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID/diffs" | ||
rules: | ||
- if: $CI_PIPELINE_SOURCE=="merge_request_event" | ||
script: | ||
- echo "merge request" | ||
- | | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"项目:${CI_PROJECT_NAME}\\n提交人:${GITLAB_USER_NAME}\\n提交信息:${CI_MERGE_REQUEST_TITLE}\\n合并分支信息:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -> ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}\\n差异性地址:${DIFF_URL}\\n请及时review代码\"}}" \ | ||
https://open.feishu.cn/open-apis/bot/v2/hook/1c334752-2874-41a1-8f1b-3060f2d46b6c | ||
frontend-builder: # 前端构建 | ||
stage: build | ||
rules: | ||
- if: $CI_COMMIT_TITLE =~ /^frontend/ && $CI_COMMIT_BRANCH == "V2.0" # 当前端提交后触发 | ||
script: | ||
- sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod | ||
- go mod tidy | ||
- ./scripts/build.sh $BUILD_DIR all ${VERSION} | ||
|
||
golang-builder: | ||
stage: build | ||
rules: | ||
- if: $CI_COMMIT_TITLE !~ /^frontend/ && $CI_COMMIT_BRANCH == "V2.0" # 当后端提交后触发 | ||
script: | ||
- sed -i '/replace github.com\/eolinker\/eosc => */d' go.mod | ||
- go mod tidy | ||
- ./scripts/build.sh $BUILD_DIR backend ${VERSION} | ||
deployer: | ||
stage: publish | ||
rules: | ||
- if: $CI_COMMIT_BRANCH=="V2.0" | ||
variables: | ||
DEPLOY_DESC: "DEV 环境" | ||
VIEW_ADDR: http://172.18.166.219:8080/ | ||
script: | ||
- cp $BUILD_DIR/${APP_PRE}_linux_amd64.tar.gz ${SAVE_DIR} | ||
- cd ${SAVE_DIR};tar -zxvf ${APP_PRE}_linux_amd64.tar.gz;cd ${APP_PRE};./install.sh ${SAVE_DIR};./run.sh restart;cd ${SAVE_DIR};./clean.sh ${APP_PRE} | ||
when: on_success | ||
success: | ||
stage: webhook | ||
rules: | ||
- if: $CI_COMMIT_BRANCH=="V2.0" | ||
variables: | ||
DEPLOY_DESC: "DEV 环境" | ||
VIEW_ADDR: http://172.18.166.219:8080/ | ||
script: | ||
- | | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:apinto-dashboard\\n环境:${DEPLOY_DESC}\\n更新部署完成.\\n访问地址:${VIEW_ADDR}\\n工作流地址:${CI_PIPELINE_URL}\"}}" \ | ||
https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338 | ||
when: on_success | ||
failure: | ||
stage: webhook | ||
rules: | ||
- if: $CI_COMMIT_BRANCH=="V2.0" | ||
variables: | ||
DEPLOY_DESC: "DEV 环境" | ||
script: | ||
- | | ||
curl -X POST -H "Content-Type: application/json" \ | ||
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"最近一次提交:${CI_COMMIT_TITLE}\\n提交人:${GITLAB_USER_NAME}\\n项目:apinto-dashboard\\n环境:${DEPLOY_DESC}\\n更新部署失败,请及时到gitlab上查看\\n工作流地址:${CI_PIPELINE_URL}\"}}" \ | ||
https://open.feishu.cn/open-apis/bot/v2/hook/c3672932-4dfa-4989-8023-0128bae59338 | ||
when: on_failure |
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,63 @@ | ||
linters: | ||
disable-all: true | ||
enable: | ||
- govet | ||
- gosimple | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused | ||
- bidichk | ||
- bodyclose | ||
- cyclop | ||
- decorder | ||
- depguard | ||
- dupl | ||
- dupword | ||
- durationcheck | ||
- errchkjson | ||
- errorlint | ||
- exhaustive | ||
- exhaustruct | ||
- exportloopref | ||
- forcetypeassert | ||
- funlen | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- godox | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- gosec | ||
- grouper | ||
- maintidx | ||
- nestif | ||
- nakedret | ||
- nilnil | ||
- nlreturn | ||
- nolintlint | ||
- paralleltest | ||
- reassign | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- testpackage | ||
# - tagliatelle | ||
- unconvert | ||
- unconvert | ||
- unparam | ||
- usestdlibvars | ||
- wastedassign | ||
run: | ||
go: 1.19 | ||
skip-dirs: | ||
- apinto-build | ||
- scripts | ||
- frontend | ||
timeout: 10m | ||
issue-exit-code: 0 | ||
output: | ||
# format: checkstyle | ||
format: colored-line-number |
Oops, something went wrong.