From 03a269df4805fa604e8fd2d04241619a739e2ae3 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 12 Jul 2022 18:33:58 +0300 Subject: [PATCH] TD-222: Update for valitydev/thrift compiler v0.14.2.3 (#19) * Use valitydev/rebar3_thrift_compiler v0.4 * Reuse common Erlang / Java workflows --- .github/workflows/build.yml | 29 ----------------- .github/workflows/deploy.yml | 31 ------------------ .github/workflows/erlang-pr.yml | 50 ++++++++++-------------------- .github/workflows/java-deploy.yml | 17 ++++++++++ .github/workflows/java-pr.yml | 10 ++++++ proto/auth_context_provider.thrift | 2 +- proto/domain.thrift | 2 +- rebar.config | 14 +++------ rebar.lock | 4 +-- 9 files changed, 52 insertions(+), 107 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/java-deploy.yml create mode 100644 .github/workflows/java-pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c7b874f..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Build Artifact - -on: - pull_request: - branches: - - '*' - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - name: Install thrift - uses: valitydev/action-setup-thrift@v0.0.5 - - name: Checkout Repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Maven - uses: actions/setup-java@v2 - with: - java-version: '15' - distribution: 'adopt' - - name: Retrieve commit info - run: | - echo "::set-output name=COMMIT_NUMBER::$(git rev-list HEAD --count)" - echo "::set-output name=SHA_7::${GITHUB_SHA::7}" - id: commit_info - - name: Build package - run: mvn --batch-mode -Dcommit.number=${{ steps.commit_info.outputs.COMMIT_NUMBER }} -Drevision="1.${{ steps.commit_info.outputs.COMMIT_NUMBER }}-${{ steps.commit_info.outputs.SHA_7 }}" clean compile -f pom.xml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 334877a..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Deploy Artifact - -on: - push: - branches: - - 'master' - - 'main' - -jobs: - deploy: - runs-on: ubuntu-20.04 - steps: - - name: Install thrift - uses: valitydev/action-setup-thrift@v0.0.5 - - name: Checkout Repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Retrieve commit info - run: | - echo "::set-output name=COMMIT_NUMBER::$(git rev-list HEAD --count)" - echo "::set-output name=SHA_7::${GITHUB_SHA::7}" - id: commit_info - - name: Deploy package - uses: valitydev/action-deploy-jdk-package@v1.0.13 - with: - 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 }} - maven-args: '-Dcommit.number=${{ steps.commit_info.outputs.COMMIT_NUMBER }} -Drevision="1.${{ steps.commit_info.outputs.COMMIT_NUMBER }}-${{ steps.commit_info.outputs.SHA_7 }}"' diff --git a/.github/workflows/erlang-pr.yml b/.github/workflows/erlang-pr.yml index 8fb4e7e..32cd36a 100644 --- a/.github/workflows/erlang-pr.yml +++ b/.github/workflows/erlang-pr.yml @@ -1,37 +1,21 @@ -name: Erlang +name: Erlang CI Checks + on: - pull_request: - branches: [ '*' ] push: - branches: [ master ] + branches: + - 'master' + - 'epic/**' + pull_request: + branches: ['**'] jobs: - build: - name: Build and verify - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v2 - - - uses: valitydev/action-setup-thrift@b457b89c7e1e960ea354f510bce69a725d16c556 - with: - thrift-version: '0.14.2' - - - uses: erlef/setup-beam@v1.10 - id: beam - with: - otp-version: '24' - rebar3-version: '3.18' - - - name: Restore PLT cache - uses: actions/cache@v2 - id: plt-cache - with: - key: | - ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-plt - path: | - _build/default/rebar3_*_plt - - - run: rebar3 compile - - run: rebar3 xref - - run: rebar3 dialyzer + run: + name: Run checks + uses: valitydev/erlang-workflows/.github/workflows/erlang-simple-build.yml@v1 + with: + otp-version: 24 + rebar-version: 3.18 + thrift-version: 0.14.2.3 + use-thrift: true + run-eunit: false + run-common-test: false diff --git a/.github/workflows/java-deploy.yml b/.github/workflows/java-deploy.yml new file mode 100644 index 0000000..2cd8c45 --- /dev/null +++ b/.github/workflows/java-deploy.yml @@ -0,0 +1,17 @@ +name: Java deploy + +on: + push: + branches: + - "master" + - "main" + +jobs: + deploy: + uses: valitydev/java-workflow/.github/workflows/maven-thrift-deploy.yml@v1 + 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 }} + mm-webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} diff --git a/.github/workflows/java-pr.yml b/.github/workflows/java-pr.yml new file mode 100644 index 0000000..0db65b3 --- /dev/null +++ b/.github/workflows/java-pr.yml @@ -0,0 +1,10 @@ +name: Java build + +on: + pull_request: + branches: + - "*" + +jobs: + build: + uses: valitydev/java-workflow/.github/workflows/maven-thrift-build.yml@v1 diff --git a/proto/auth_context_provider.thrift b/proto/auth_context_provider.thrift index fc54ea8..e64e34e 100644 --- a/proto/auth_context_provider.thrift +++ b/proto/auth_context_provider.thrift @@ -1,5 +1,5 @@ namespace java dev.vality.orgmanagement -namespace erlang orgmgmt +namespace erlang orgmgmt.authctx_provider include "domain.thrift" include "proto/context.thrift" diff --git a/proto/domain.thrift b/proto/domain.thrift index c9f8c01..6ceffe2 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -1,4 +1,4 @@ namespace java dev.vality.orgmanagement -namespace erlang orgmgmt +namespace erlang orgmgmt.domain typedef string UserID diff --git a/rebar.config b/rebar.config index 55303b4..be7eaa8 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,5 @@ %% Common project erlang options. {erl_opts, [ - % mandatory debug_info, warnings_as_errors, @@ -26,11 +25,7 @@ ]}. {deps, [ - {bouncer_proto, - {git, "https://github.com/valitydev/bouncer-proto.git", - {branch, "master"} - } - } + {bouncer_proto, {git, "https://github.com/valitydev/bouncer-proto.git", {branch, "master"}}} ]}. %% XRef checks @@ -58,18 +53,17 @@ {plugins, [ {rebar3_thrift_compiler, - {git, "https://github.com/valitydev/rebar3_thrift_compiler.git", {branch, "master"}}} + {git, "https://github.com/valitydev/rebar3_thrift_compiler.git", {tag, "0.4"}}} ]}. {provider_hooks, [ {pre, [ {compile, {thrift, compile}}, - {clean , {thrift, clean }} + {clean, {thrift, clean}} ]} ]}. {thrift_compiler_opts, [ {in_dir, "proto"}, - {in_files, all}, - {gen, "erlang:scoped_typenames,app_prefix=orgmgmt"} + {gen, "erlang:app_namespaces"} ]}. diff --git a/rebar.lock b/rebar.lock index 88878aa..23c3a02 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,4 +1,4 @@ [{<<"bouncer_proto">>, - {git,"https://github.com/valitydev/bouncer-proto", - {ref,"3b5927d4ee59983e855f87ddaee2aac4deeae0fe"}}, + {git,"https://github.com/valitydev/bouncer-proto.git", + {ref,"de15d375ee77c5002c55a1ba9a20a67d2c222115"}}, 0}].