From b682b091a9f34316d3e899786f9e1d27665eebec Mon Sep 17 00:00:00 2001 From: Egor Cherniak Date: Mon, 24 Jan 2022 14:29:19 +0300 Subject: [PATCH] Build impl + renovate + actualization --- .github/workflows/build.yaml | 30 ++++++ .github/workflows/deploy-jar.yaml | 16 +++ .github/workflows/gh-pages.yaml | 28 ++++++ .gitmodules | 4 - Jenkinsfile | 61 ------------ Makefile | 98 ------------------- README.md | 4 +- build_utils | 1 - .../components/security-schemes/bearer.yaml | 2 +- openapi/openapi.yaml | 16 +-- package.json | 8 +- pom.xml | 20 ++-- renovate.json | 18 ++++ web/index.html | 2 +- 14 files changed, 118 insertions(+), 190 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/deploy-jar.yaml create mode 100644 .github/workflows/gh-pages.yaml delete mode 100644 .gitmodules delete mode 100644 Jenkinsfile delete mode 100644 Makefile delete mode 160000 build_utils create mode 100644 renovate.json diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a00a774 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,30 @@ +name: build +on: + - pull_request + +env: + NODEJS_VERSION: '16' + +jobs: + bundle: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Maven + uses: actions/setup-java@v2 + with: + java-version: '15' + distribution: 'adopt' + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODEJS_VERSION }} + cache: npm + - run: npm install + - name: Bundle specification + run: npm run build + - name: Validate specification + run: npm run test + - name: Build server jar + run: mvn --batch-mode clean package -f pom.xml -P="server" \ No newline at end of file diff --git a/.github/workflows/deploy-jar.yaml b/.github/workflows/deploy-jar.yaml new file mode 100644 index 0000000..9b7d6c3 --- /dev/null +++ b/.github/workflows/deploy-jar.yaml @@ -0,0 +1,16 @@ +name: Maven Deploy Artifact + +on: + push: + branches: + - 'master' + - 'main' + +jobs: + deploy: + uses: valitydev/base-workflow/.github/workflows/maven-library-deploy.yml@v1.0.1 + secrets: + server-username: ${{ secrets.OSSRH_USERNAME }} + server-password: ${{ secrets.OSSRH_TOKEN }} + deploy-secret-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + deploy-secret-key-password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml new file mode 100644 index 0000000..5cb134a --- /dev/null +++ b/.github/workflows/gh-pages.yaml @@ -0,0 +1,28 @@ +name: gh-pages +on: + push: + branches: [master] + +env: + NODEJS_VERSION: '16' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODEJS_VERSION }} + cache: npm + - run: npm install + - name: Bundle specification + run: npm run build + - name: Publish ReDoc on Github Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + exclude_assets: 'swagger-ui' \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ca5a761..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "build_utils"] - path = build_utils - url = git@github.com:rbkmoney/build_utils.git - branch = master diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index aa6bb26..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,61 +0,0 @@ -#!groovy -// -*- mode: groovy -*- - -build('swag-anapi-v2', 'docker-host') { - checkoutRepo() - loadBuildUtils('build_utils') - - def pipeDefault - def withWsCache - def gitUtils - runStage('load pipeline') { - env.JENKINS_LIB = "build_utils/jenkins_lib" - pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy") - withWsCache = load("${env.JENKINS_LIB}/withWsCache.groovy") - gitUtils = load("${env.JENKINS_LIB}/gitUtils.groovy") - } - - pipeDefault() { - - runStage('install-deps') { - withWsCache("node_modules") { - sh 'make wc_install' - } - } - - runStage('validate-spec') { - sh 'make wc_validate' - } - - runStage('bundle') { - sh 'make wc_build' - } - - // Java - runStage('build java client & server') { - env.JAVA_HOME = sh(returnStdout: true, script: 'java-config --select-vm openjdk-bin-11 --jdk-home').trim() - withMaven() { - if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic/')) { - withGPG() { - sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} REPO_PUBLIC=${REPO_PUBLIC} GPG_PASSPHRASE=${GPG_PASSPHRASE} GPG_KEYID=${GPG_KEYID} java.openapi.deploy_client' - sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} REPO_PUBLIC=${REPO_PUBLIC} GPG_PASSPHRASE=${GPG_PASSPHRASE} GPG_KEYID=${GPG_KEYID} java.openapi.deploy_server' - } - } else { - sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.openapi.compile_client' - sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} java.openapi.compile_server' - } - } - } - - // Release - if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic/')) { - runStage('publish release bundle') { - dir("web_deploy") { - gitUtils.push(commitMsg: "Generated from commit: $COMMIT_ID \n\non $BRANCH_NAME in $RBK_REPO_URL\n\nChanges:\n$COMMIT_MSG", - files: "*", branch: "release/$BRANCH_NAME", orphan: true) - } - } - } - - } -} diff --git a/Makefile b/Makefile deleted file mode 100644 index f25bebc..0000000 --- a/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -UTILS_PATH := build_utils -TEMPLATES_PATH := . - -SERVICE_NAME := swag-anapi-v2 -BUILD_IMAGE_TAG := 917afcdd0c0a07bf4155d597bbba72e962e1a34a - -CALL_ANYWHERE := all install validate build java.compile java.deploy -CALL_W_CONTAINER := $(CALL_ANYWHERE) - -all: validate - --include $(UTILS_PATH)/make_lib/utils_container.mk - -.PHONY: $(CALL_W_CONTAINER) - -install: - npm install - -validate: - npm run validate - -build: - npm run build - -# Java - -ifdef SETTINGS_XML -DOCKER_RUN_OPTS = -v $(SETTINGS_XML):$(SETTINGS_XML) -DOCKER_RUN_OPTS += -e SETTINGS_XML=$(SETTINGS_XML) -endif - -ifdef LOCAL_BUILD -DOCKER_RUN_OPTS += -v $$HOME/.m2:/home/$(UNAME)/.m2:rw -endif - -COMMIT_HASH := $(shell git --no-pager log -1 --pretty=format:"%h") -NUMBER_COMMITS := $(shell git rev-list --count HEAD) - -JAVA_PKG_VERSION := 1.$(NUMBER_COMMITS)-$(COMMIT_HASH) - -ifdef BRANCH_NAME -ifeq "$(findstring epic,$(BRANCH_NAME))" "epic" -JAVA_PKG_VERSION := $(JAVA_PKG_VERSION)-epic -endif -endif - -REPO_PROFILE := private - -ifdef REPO_PUBLIC -ifeq ($(REPO_PUBLIC), true) -REPO_PROFILE := public -endif -endif - -MVN = mvn -s $(SETTINGS_XML) -Dcommit.number="$(NUMBER_COMMITS)" - -java.openapi.compile_client: java.settings - $(MVN) clean && \ - $(MVN) compile -P="client" -P="$(REPO_PROFILE)" - -java.openapi.deploy_client: java.settings - $(MVN) clean && \ - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-client" && \ - $(MVN) deploy --batch-mode -Dgpg.keyname="$(GPG_KEYID)" -Dgpg.passphrase="$(GPG_PASSPHRASE)" -P="client" -P="$(REPO_PROFILE)" - -java.openapi.install_client: java.settings - $(MVN) clean && \ - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-client" && \ - $(MVN) install -P="client" -P="$(REPO_PROFILE)" - -java.openapi.compile_server: java.settings - $(MVN) clean && \ - $(MVN) compile -P="server" -P="$(REPO_PROFILE)" - -java.openapi.deploy_server: java.settings - $(MVN) clean && \ - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-server" && \ - $(MVN) deploy --batch-mode -Dgpg.keyname="$(GPG_KEYID)" -Dgpg.passphrase="$(GPG_PASSPHRASE)" -P="server" -P="$(REPO_PROFILE)" - -java.openapi.install_server: java.settings - $(MVN) clean && \ - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)-server" && \ - $(MVN) install -P="server" -P="$(REPO_PROFILE)" - -java.compile: java.settings - $(MVN) compile - -java.deploy: java.settings - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \ - $(MVN) deploy - -java.install: java.settings - $(MVN) clean && \ - $(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \ - $(MVN) install - -java.settings: - $(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1) diff --git a/README.md b/README.md index fbb1428..fb7816c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RBKmoney Analytics API Specification (OpenAPI 3.0) +# Vality Analytics API Specification (OpenAPI 3.0) ## Working on specification ### Install @@ -10,7 +10,7 @@ ### Usage 1. Run `npm start` -2. Checkout console output to see where local server is started. You can use all [links](#links) (except `preview`) by replacing https://git@github.com:antonlva.github.io/rbkmoney-api-docs.git/ with url from the message: `Server started ` +2. Checkout console output to see where local server is started. You can use all [links](#links) (except `preview`) by replacing https://github.com/valitydev/docs.git with url from the message: `Server started ` 3. Make changes using your favorite editor or `swagger-editor` (look for URL in console output) 4. All changes are immediately propagated to your local server, moreover all documentation pages will be automagically refreshed in a browser after each change **TIP:** you can open `swagger-editor`, documentation and `swagger-ui` in parallel diff --git a/build_utils b/build_utils deleted file mode 160000 index be44d69..0000000 --- a/build_utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit be44d69fc87b22a0bb82d98d6eae7658d1647f98 diff --git a/openapi/components/security-schemes/bearer.yaml b/openapi/components/security-schemes/bearer.yaml index 980fee8..e70d729 100644 --- a/openapi/components/security-schemes/bearer.yaml +++ b/openapi/components/security-schemes/bearer.yaml @@ -10,7 +10,7 @@ description: > ``` Посмотреть ваш API-ключ вы можете в [личном - кабинете](https://dashboard.rbk.money/). + кабинете](https://dashboard.vality/). Помните, что вы никому не должны передавать ваш API ключ! diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index a35bf97..8e87ee0 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1,12 +1,12 @@ openapi: 3.0.0 info: version: 2.0.0 - title: RBKmoney Platform Analytics API + title: Vality Platform Analytics API description: | ## Описание - RBKmoney Analytics API является точкой взаимодействия с аналитической и поисковой частью платформы. Все аналитическоие запросы осуществляются с помощью вызовов соответствующих методов API. Любые сторонние приложения, включая наши веб-сайты, личные кабинеты и другие UI-интерфейсы являются внешними приложениями-клиентами. + Vality Analytics API является точкой взаимодействия с аналитической и поисковой частью платформы. Все аналитическоие запросы осуществляются с помощью вызовов соответствующих методов API. Любые сторонние приложения, включая наши веб-сайты, личные кабинеты и другие UI-интерфейсы являются внешними приложениями-клиентами. - RBKmoney Analytics API работает поверх HTTP-протокола. Мы используем REST архитектуру, схема описывается в соответствии со стандартом [OpenAPI v3.0](https://spec.openapis.org/oas/v3.0.0/). Коды возврата описываются соответствующими HTTP-статусами. Платформа принимает и возвращает JSON-структуры в HTTP body. + Vality Analytics API работает поверх HTTP-протокола. Мы используем REST архитектуру, схема описывается в соответствии со стандартом [OpenAPI v3.0](https://spec.openapis.org/oas/v3.0.0/). Коды возврата описываются соответствующими HTTP-статусами. Платформа принимает и возвращает JSON-структуры в HTTP body. ## Запросы Любой вызов методов API обязан предваряться предоставлением уникального для участника в пределах платформы ID запроса. Данный ID передается в соответствующем заголовке HTTP-запроса: @@ -88,16 +88,16 @@ info: [5xx]: https://tools.ietf.org/html/rfc7231#section-6.6 Если вы получили ошибку, которой нет в данном описании, обратитесь в техническую поддержку. - termsOfService: https://rbk.money/ + termsOfService: https://vality.dev/ contact: - name: RBKmoney support team - email: support@rbk.money - url: https://api.rbk.money/lk/v2 + name: Vality support team + email: support@vality.dev + url: https://vality.dev/lk/v2 license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - - url: 'https://api.rbk.money/lk/v2' + - url: 'https://api.vality.dev/lk/v2' security: - bearer: [ ] tags: diff --git a/package.json b/package.json index e39bc56..bbb734d 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "swag-anapi-v2", - "version": "0.1.0", + "version": "1.0.0", "private": true, "dependencies": { - "@redocly/openapi-cli": "^1.0.0-beta.61", - "json-merge-patch": "^1.0.0", - "redoc-cli": "^0.12.1" + "@redocly/openapi-cli": "^1.0.0-beta.79", + "json-merge-patch": "^1.0.2", + "redoc-cli": "^0.13.2" }, "scripts": { "start": "openapi preview-docs", diff --git a/pom.xml b/pom.xml index 3107441..8dafc4f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 - com.rbkmoney + dev.vality library-parent-pom - 1.0.8 + 1.0.2 swag-anapi-v2 @@ -19,21 +19,21 @@ - com.rbkmoney.anapi.v2 + dev.vality.anapi.v2 UTF-8 1.0.0 11 ${java.version} ${java.version} - 1.7.21 + 1.7.33 4.13.2 2.5 - 2.12.5 - 2.5.3 - 2.9.2 + 2.13.1 + 2.6.1 + 3.0.0 1.3.2 2.3.1 - 5.2.1 + 5.3.1 @@ -86,7 +86,7 @@ io.swagger swagger-annotations - 1.6.2 + 1.6.4 provided @@ -129,7 +129,7 @@ org.openapitools jackson-databind-nullable - 0.2.1 + 0.2.2 provided diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..2fece3b --- /dev/null +++ b/renovate.json @@ -0,0 +1,18 @@ +{ + "extends": [ + "config:base" + ], + "packageRules": [ + { + "matchPackagePatterns": [ + "*" + ], + "matchUpdateTypes": [ + "minor", + "patch" + ], + "groupName": "all non-major dependencies", + "groupSlug": "all-minor-patch" + } + ] +} \ No newline at end of file diff --git a/web/index.html b/web/index.html index 36cdc90..c4de90f 100644 --- a/web/index.html +++ b/web/index.html @@ -2,7 +2,7 @@ - RBKmoney Anapi v2 API + Vality Anapi v2 API