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/.github/workflows/main.yml b/.github/workflows/main.yml index 1662b09..35f2a67 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,12 +1,7 @@ name: Build and Release -on: - push: - branches: - - master - tags: - - 'v*.*.*' - +on: pull_request + jobs: run-unit-tests: strategy: @@ -44,6 +39,7 @@ jobs: path: test-results verify: + if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - name: Checkout code @@ -116,4 +112,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 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)