From 8ef6a3f7701ddd876bc13d08a232fe4823e47cba Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:16:38 +0300 Subject: [PATCH 1/6] Remove Circle, fix TTY issue in verify script --- .circleci/config.yml | 127 ------------------------------------------- verify.sh | 2 +- 2 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3c57f08..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,127 +0,0 @@ -### ============================================================= -### This configuration file is used by CircleCI build server -### https://circleci.com/docs/sample-config -### ============================================================= -version: 2.1 - -parameters: - docker_image_for_publishing: - # python 3.10 is the latest supported version - description: "Docker image to use for the build" - type: string - default: cimg/python:3.12 - -references: - install_poetry: &install_poetry - - run: - name: Install Poetry - command: | - # in old images we need to remove existing poetry - rm -rf $HOME/.poetry/bin/poetry - sudo curl -sSL https://install.python-poetry.org | python3 - - poetry --version - - install_project_dependencies: &install_project_dependencies - - run: - name: Install Project Dependencies - command: | - poetry install --no-interaction --no-ansi --no-root - - poetry_build: &poetry_build - - run: - name: Build Package - command: | - poetry build - - version_tag_regex: &version_tag_regex - /^v\d+\.\d+\.\d+$/ # version regex vx.x.x (i.e. v1.2.3) - - # step only run if is match the filter - # the step run on all branches - tag_filter: &tag_filter - filters: - tags: - only: *version_tag_regex - - -jobs: - run-unit-tests: - parameters: - pythonversion: - type: string - docker: - - image: cimg/python:<< parameters.pythonversion >> - steps: - - checkout - - <<: *install_poetry - - <<: *install_project_dependencies - - run: - name: Run Unit Tests - command: | - mkdir test-results - poetry run python -m pytest --junitxml=test-results/junit.xml -v tests - - store_test_results: - path: test-results - verify: - machine: - image: default - steps: - - checkout - - run: - name: Verify - command: | - ./verify.sh - - publish-to-test-pypi: - docker: - - image: << pipeline.parameters.docker_image_for_publishing >> - steps: - - checkout - - <<: *poetry_build - - run: - name: Publish Package To Test PyPI - command: | - poetry config repositories.testpypi https://test.pypi.org/legacy/ - poetry publish -u __token__ -p ${PYPI_TEST_TOKEN} -r testpypi - - - publish-to-pypi: - docker: - - image: << pipeline.parameters.docker_image_for_publishing >> - steps: - - checkout - - <<: *poetry_build - - run: - name: Publish Package To PyPI - command: | - poetry publish -u __token__ -p ${PYPI_TOKEN} - -workflows: - build_and_release: - jobs: - - run-unit-tests: - <<: *tag_filter # we add it for the publish-to-pypi step - matrix: - parameters: - pythonversion: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: run-unit-tests-<< matrix.pythonversion >> - - verify: - <<: *tag_filter # we add it for the publish-to-pypi step - # comment out the publish-to-test-pypi step until we automate version bumping - # - publish-to-test-pypi: - # requires: - # - run-unit-tests - # - verify - # filters: - # branches: - # only: master - - publish-to-pypi: - requires: - - run-unit-tests - - verify - filters: - tags: - only: *version_tag_regex - branches: - ignore: /.*/ - \ No newline at end of file diff --git a/verify.sh b/verify.sh index e45eef3..5d7500c 100755 --- a/verify.sh +++ b/verify.sh @@ -6,7 +6,7 @@ set -e # Script to run extra verifications # Verify that code-gen.sh doesn't generate a diff -bash -x ./gen-code.sh +bash ./gen-code.sh # Removed the '-x' for verbosity in CI # we diff only the code DIFF_OUT=$(git diff -- demisto_client) From 819cfe3c46ff5a902aab6c5cb4acc634e04b8dbb Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:22:34 +0300 Subject: [PATCH 2/6] UTs should run on each push --- .github/workflows/main.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1662b09..06ab80b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,12 +1,15 @@ name: Build and Release on: - push: + push: # This applies to all pushes branches: - - master - tags: - - 'v*.*.*' - + - '**' # Run on all branches for push + pull_request: + branches: + - '**' # Run unit tests on all PRs as well + tags: + - 'v*.*.*' # For tag pushes + jobs: run-unit-tests: strategy: @@ -44,6 +47,7 @@ jobs: path: test-results verify: + if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - name: Checkout code @@ -116,4 +120,4 @@ jobs: env: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} run: | - poetry publish -u __token__ -p $PYPI_TOKEN + poetry publish -u __token__ -p $PYPI_TOKEN \ No newline at end of file From 866e78588938b1111c87f6713b37b6354ffaa03f Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:25:36 +0300 Subject: [PATCH 3/6] UTs should run on each push --- .github/workflows/main.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06ab80b..79cc01c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,14 +1,11 @@ name: Build and Release on: - push: # This applies to all pushes + push: branches: - '**' # Run on all branches for push - pull_request: - branches: - - '**' # Run unit tests on all PRs as well tags: - - 'v*.*.*' # For tag pushes + - 'v*.*.*' # Run on version tags jobs: run-unit-tests: From 2d7627fe09ccd65aaf22ce0b51cd808a94ebc3d5 Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:29:26 +0300 Subject: [PATCH 4/6] UTs should run on each push --- .github/workflows/main.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79cc01c..35f2a67 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,6 @@ name: Build and Release -on: - push: - branches: - - '**' # Run on all branches for push - tags: - - 'v*.*.*' # Run on version tags +on: pull_request jobs: run-unit-tests: From 45330e87fa17678a85746742fba4468185c4fb28 Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:31:36 +0300 Subject: [PATCH 5/6] All branches, not just pr --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 35f2a67..8760b8a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ name: Build and Release -on: pull_request +on: + push: + branches: + - '**' # Run on all branches for push jobs: run-unit-tests: From 1a45946ffa5a4f160cb48586f77601e6b56e6d8e Mon Sep 17 00:00:00 2001 From: Amichai Date: Sun, 8 Sep 2024 13:43:11 +0300 Subject: [PATCH 6/6] All branches, not just pr --- verify.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verify.sh b/verify.sh index 5d7500c..bbe7e4c 100755 --- a/verify.sh +++ b/verify.sh @@ -6,7 +6,7 @@ set -e # Script to run extra verifications # Verify that code-gen.sh doesn't generate a diff -bash ./gen-code.sh # Removed the '-x' for verbosity in CI +bash ./gen-code.sh