diff --git a/.circleci/config.yml b/.circleci/config.yml index 219cee6b42..c6d6e3bb51 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -264,6 +264,51 @@ jobs: echo $DOCKER_PWD | docker login -u $DOCKER_LOGIN --password-stdin docker build -t zenithdb/zenith:latest . && docker push zenithdb/zenith:latest + # Trigger a new remote CI job + remote-ci-trigger: + docker: + - image: cimg/base:2021.04 + parameters: + remote_repo: + type: string + environment: + REMOTE_REPO: << parameters.remote_repo >> + steps: + - run: + name: Set PR's status to pending + command: | + LOCAL_REPO=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME + + curl -f -X POST \ + https://api.github.com/repos/$LOCAL_REPO/statuses/$CIRCLE_SHA1 \ + -H "Accept: application/vnd.github.v3+json" \ + --user "$CI_ACCESS_TOKEN" \ + --data \ + "{ + \"state\": \"pending\", + \"context\": \"zenith-remote-ci\", + \"description\": \"[$REMOTE_REPO] Remote CI job is about to start\" + }" + - run: + name: Request a remote CI test + command: | + LOCAL_REPO=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME + + curl -f -X POST \ + https://api.github.com/repos/$REMOTE_REPO/actions/workflows/testing.yml/dispatches \ + -H "Accept: application/vnd.github.v3+json" \ + --user "$CI_ACCESS_TOKEN" \ + --data \ + "{ + \"ref\": \"main\", + \"inputs\": { + \"ci_job_name\": \"zenith-remote-ci\", + \"commit_hash\": \"$CIRCLE_SHA1\", + \"remote_repo\": \"$LOCAL_REPO\", + \"zenith_image_branch\": \"$CIRCLE_BRANCH\" + } + }" + workflows: build_and_test: jobs: @@ -277,7 +322,7 @@ workflows: requires: - build-postgres - run-pytest: - name: pg_regress tests << matrix.build_type >> + name: pg_regress-tests-<< matrix.build_type >> matrix: parameters: build_type: ["debug", "release"] @@ -286,7 +331,7 @@ workflows: requires: - build-zenith-<< matrix.build_type >> - run-pytest: - name: other tests << matrix.build_type >> + name: other-tests-<< matrix.build_type >> matrix: parameters: build_type: ["debug", "release"] @@ -308,5 +353,16 @@ workflows: only: - main requires: - - pg_regress tests release - - other tests release + - pg_regress-tests-release + - other-tests-release + - remote-ci-trigger: + # Context passes credentials for gh api + context: CI_ACCESS_TOKEN + remote_repo: "zenithdb/console" + requires: + # XXX: Successful build doesn't mean everything is OK, but + # the job to be triggered takes so much time to complete (~22 min) + # that it's better not to wait for the commented-out steps + - build-zenith-debug + # - pg_regress-tests-release + # - other-tests-release