diff --git a/.circleci/config.yml b/.circleci/config.yml index 83eec856d0..111ff0c12f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,6 +167,25 @@ jobs: - run: make install-hex-rebar - run: mix do compile --warnings-as-errors --force, credo, format --check-formatted --dry-run + lint_version: + executor: builder + steps: + - setup_elixir-omg_workspace + - run: + command: | + if [ -n "$CIRCLE_TAG" ]; then + _tagged_version="${CIRCLE_TAG#*v}" + _filed_version="$(head -n 1 ./VERSION | sed 's/^[ \t]*//;s/[ \t]*$//')" + + if [ "$_tagged_version" != "$_filed_version" ]; then + echo "The git tag \"${CIRCLE_TAG}\" expects the VERSION to be \"${_tagged_version}\". Got \"${_filed_version}\"." + exit 1 + fi + else + echo "This build is not version-tagged. Skipping version lint." + exit 0 + fi + sobelow: executor: builder_pg environment: @@ -674,6 +693,8 @@ workflows: requires: [build] - lint: requires: [build] + - lint_version: + requires: [build] - sobelow: requires: [build] - dialyzer: @@ -682,7 +703,7 @@ workflows: requires: [build] - property_tests: requires: [build] - # Publish in case of master branch. + # Publish in case of master branch, version branches and version tags. - publish_child_chain: requires: [ @@ -694,13 +715,18 @@ workflows: property_tests, dialyzer, lint, + lint_version, ] filters: branches: only: - master # vMAJOR.MINOR (e.g. v0.1, v0.2, v1.0, v2.1, etc.) - - /v[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ + tags: + only: + # vMAJOR.MINOR.PATCH (e.g. v0.1.0, v0.2.9, v1.0.0, v2.1.3 etc.) + - /^v[0-9]+\.[0-9]+\.[0-9]+/ - publish_watcher: requires: [ @@ -712,13 +738,18 @@ workflows: property_tests, dialyzer, lint, + lint_version, ] filters: branches: only: - master # vMAJOR.MINOR (e.g. v0.1, v0.2, v1.0, v2.1, etc.) - - /v[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ + tags: + only: + # vMAJOR.MINOR.PATCH (e.g. v0.1.0, v0.2.9, v1.0.0, v2.1.3 etc.) + - /^v[0-9]+\.[0-9]+\.[0-9]+/ - publish_watcher_info: requires: [ @@ -730,13 +761,18 @@ workflows: property_tests, dialyzer, lint, + lint_version, ] filters: branches: only: - master # vMAJOR.MINOR (e.g. v0.1, v0.2, v1.0, v2.1, etc.) - - /v[0-9]+\.[0-9]+/ + - /^v[0-9]+\.[0-9]+/ + tags: + only: + # vMAJOR.MINOR.PATCH (e.g. v0.1.0, v0.2.9, v1.0.0, v2.1.3 etc.) + - /^v[0-9]+\.[0-9]+\.[0-9]+/ # Release deploy to development in case of master branch. - deploy_child_chain: requires: [publish_child_chain, publish_watcher, publish_watcher_info]