diff --git a/.circleci/config-conditional-builds.yml b/.circleci/config-conditional-builds.yml new file mode 100644 index 00000000000..0dafc030cc5 --- /dev/null +++ b/.circleci/config-conditional-builds.yml @@ -0,0 +1,80 @@ +version: 2.1 + +orbs: + codecov: codecov/codecov@3.2.2 + +jobs: + tests: + docker: + - image: 'cimg/python:3.10' + environment: + TOX_POSARGS: '' + - image: 'docker.elastic.co/elasticsearch/elasticsearch:7.14.0' + name: search + environment: + discovery.type: single-node + ES_JAVA_OPTS: -Xms750m -Xmx750m + steps: + - when: + condition: + or: + - build-code + - equal: [ main, << pipeline.git.branch >> ] + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - run: pip install --user 'tox<5' + - run: tox -e py310 + - codecov/upload + + tests-embedapi: + docker: + - image: 'cimg/python:3.10' + steps: + - when: + condition: + or: + - build-code + - equal: [ main, << pipeline.git.branch >> ] + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - run: pip install --user 'tox<4' + - run: tox -c tox.embedapi.ini + + checks: + docker: + - image: 'cimg/python:3.10' + environment: + NODE_VERSION: 10.17.0 + # This could also be done more conditionally like the former tests + steps: + - checkout + - run: git submodule sync + - run: git submodule update --init + - run: git fetch origin main # needed for comparisson in pre-commit + - run: git branch -f --track main origin/main # needed for comparisson in pre-commit + - run: pip install --user 'tox<5' + - run: tox -e migrations + - run: tox -e pre-commit + - run: tox -e lint + - run: scripts/circle/install_node.sh + - run: + name: Add node to the path + command: | + echo 'export PATH=~/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH' >> $BASH_ENV + source $BASH_ENV + - run: tox -e eslint + +workflows: + version: 2 + test: + jobs: + - checks + - tests + - tests-embedapi: + requires: + - checks + - tests diff --git a/.circleci/config.yml b/.circleci/config.yml index c6ffe178d9d..884a1c408d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,67 +1,22 @@ version: 2.1 -orbs: - codecov: codecov/codecov@3.2.2 - -jobs: - tests: - docker: - - image: 'cimg/python:3.10' - environment: - TOX_POSARGS: '' - - image: 'docker.elastic.co/elasticsearch/elasticsearch:7.14.0' - name: search - environment: - discovery.type: single-node - ES_JAVA_OPTS: -Xms750m -Xmx750m - steps: - - checkout - - run: git submodule sync - - run: git submodule update --init - - run: pip install --user 'tox<5' - - run: tox -e py310 - - codecov/upload +setup: true - tests-embedapi: - docker: - - image: 'cimg/python:3.10' - steps: - - checkout - - run: git submodule sync - - run: git submodule update --init - - run: pip install --user 'tox<4' - - run: tox -c tox.embedapi.ini - - checks: - docker: - - image: 'cimg/python:3.10' - environment: - NODE_VERSION: 10.17.0 - steps: - - checkout - - run: git submodule sync - - run: git submodule update --init - - run: git fetch origin main # needed for comparisson in pre-commit - - run: git branch -f --track main origin/main # needed for comparisson in pre-commit - - run: pip install --user 'tox<5' - - run: tox -e pre-commit - - run: tox -e migrations - - run: tox -e lint - - run: scripts/circle/install_node.sh - - run: - name: Add node to the path - command: | - echo 'export PATH=~/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH' >> $BASH_ENV - source $BASH_ENV - - run: tox -e eslint +orbs: + path-filtering: circleci/path-filtering@0.1.3 workflows: - version: 2 - test: + generate-config: jobs: - - checks - - tests - - tests-embedapi: - requires: - - checks - - tests + - path-filtering/filter: + base-revision: main + config-path: .circleci/config-conditional-builds.yml + mapping: | + requirements/.* build-code true + readthedocs/.* build-code true + pytest.* build-code true + tox.* build-code true + package.* build-code true + \.circleci/* build-code true + common build-code true + setup.* build-code true