From f05dbac36b387cb9b04a56214f2246963a45757e Mon Sep 17 00:00:00 2001 From: vitaxa Date: Thu, 20 Jan 2022 14:43:46 +0300 Subject: [PATCH] refactor gh build (#3) --- .github/workflows/build.yml | 23 +------- .github/workflows/deploy.yml | 29 +++------- .github/workflows/erlang-build-verify.yml | 10 ++++ rebar.config | 69 +++++++++++++++++++++++ rebar.lock | 1 + 5 files changed, 89 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/erlang-build-verify.yml create mode 100644 rebar.config create mode 100644 rebar.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39329a5..1f3a059 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Artifact +name: Maven Build Artifact on: pull_request: @@ -7,23 +7,4 @@ on: jobs: build: - runs-on: ubuntu-20.04 - steps: - - name: Install thrift - uses: valitydev/action-setup-thrift@v0.0.1 - - 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 + uses: valitydev/base-workflow/.github/workflows/maven-thrift-build.yml@v1.0.0 \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 511ba27..e6cdb3f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy Artifact +name: Maven Deploy Artifact on: push: @@ -8,24 +8,9 @@ on: jobs: deploy: - runs-on: ubuntu-20.04 - steps: - - name: Install thrift - uses: valitydev/action-setup-thrift@v0.0.1 - - 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.12 - 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 }}"' + uses: valitydev/base-workflow/.github/workflows/maven-thrift-deploy.yml@v1.0.0 + 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 }} \ No newline at end of file diff --git a/.github/workflows/erlang-build-verify.yml b/.github/workflows/erlang-build-verify.yml new file mode 100644 index 0000000..995e09b --- /dev/null +++ b/.github/workflows/erlang-build-verify.yml @@ -0,0 +1,10 @@ +name: Erlang Build And Verify + +on: + pull_request: + branches: + - '*' + +jobs: + build: + uses: valitydev/base-workflow/.github/workflows/erlang-thrift-build.yml@v1.0.0 \ No newline at end of file diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..b49dbb0 --- /dev/null +++ b/rebar.config @@ -0,0 +1,69 @@ +%% Common project erlang options. +{erl_opts, [ + + % mandatory + debug_info, + warnings_as_errors, + warn_export_all, + warn_missing_spec, + warn_untyped_record, + warn_export_vars, + + % by default + warn_unused_record, + warn_bif_clash, + warn_obsolete_guard, + warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_unused_function, + warn_deprecated_function, + + % at will + % bin_opt_info + % no_auto_import, + warn_missing_spec_all +]}. + +%% XRef checks +{xref_checks, [ + undefined_function_calls, + undefined_functions, + deprecated_functions_calls, + deprecated_functions +]}. + +%% Tests +{cover_enabled, true}. + +%% Dialyzer static analyzing +{dialyzer, [ + {warnings, [ + % mandatory + unmatched_returns, + error_handling, + race_conditions, + unknown + ]}, + {plt_apps, all_deps} +]}. + +{deps, []}. + +{plugins, [ + {rebar3_thrift_compiler, + {git, "https://github.com/valitydev/rebar3_thrift_compiler.git", {tag, "0.3.1"}}} +]}. + +{provider_hooks, [ + {pre, [ + {compile, {thrift, compile}}, + {clean , {thrift, clean }} + ]} +]}. + +{thrift_compiler_opts, [ + {in_dir, "proto"}, + {in_files, all}, + {gen, "erlang:scoped_typenames"} +]}. diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..57afcca --- /dev/null +++ b/rebar.lock @@ -0,0 +1 @@ +[].