Skip to content

Commit

Permalink
[CI] Github tests trigger for CircleCI (mckinsey#484)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Antony Milne <antony.milne@quantumblack.com>
3 people authored May 27, 2024
1 parent 06b43a1 commit f0a184b
Showing 3 changed files with 102 additions and 116 deletions.
112 changes: 0 additions & 112 deletions .circleci/config.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/circleci-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CircleCI tests trigger

on:
push:
branches: [main]
pull_request:
branches:
- main

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

jobs:
circleci-trigger-fork:
if: ${{ github.event.pull_request.head.repo.fork }}
name: CircleCI tests trigger
runs-on: ubuntu-latest
steps:
- name: Passed fork step
run: echo "Success!"

circleci-trigger:
if: ${{ ! github.event.pull_request.head.repo.fork }}
name: CircleCI tests trigger
environment: circleci_secrets
runs-on: ubuntu-latest
steps:
- name: Start CircleCI pipeline
run: |
create_circleci_pipeline() {
local branch=$1
local json_data=$(jq -n --arg branch "$branch" --arg vizro_branch "${{ github.head_ref }}" '{branch: $branch, parameters: {branch: $branch, vizro_branch: $vizro_branch}}')
curl --silent --request POST \
--url "${{ secrets.QA_PIPELINE_URL }}" \
--header "Circle-Token: ${{ secrets.CIRCLECI_API_KEY }}" \
--header "content-type: application/json" \
--data "$json_data" \
| jq -r '.id'
}
PIPELINE=$(create_circleci_pipeline "${{ github.head_ref }}")
# If the above returns null then the QA repo doesn't contain current dev branch, so we use main branch.
if [[ "$PIPELINE" == "null" ]]; then
PIPELINE=$(create_circleci_pipeline "main")
fi
echo "Started pipeline with id $PIPELINE"
echo "PIPELINE=$PIPELINE" >> $GITHUB_ENV
- name: Wait for pipeline to run
run: sleep 60

- name: Check pipeline status
run: |
get_pipeline_status() {
curl --silent --request GET \
--url "https://circleci.com/api/v2/pipeline/$PIPELINE/workflow" \
--header "Circle-Token: ${{ secrets.CIRCLECI_API_KEY }}" \
--header "content-type: application/json" \
| jq -r '.items[0].status'
}
while pipeline_status=$(get_pipeline_status); [[ "$pipeline_status" == "running" ]]; do
echo $pipeline_status
sleep 15
done
if [[ "$pipeline_status" != "success" ]]; then
echo "Pipeline not completed successfully - status was ${pipeline_status}"
exit 1
fi
31 changes: 27 additions & 4 deletions .github/workflows/test-integration-vizro-ai.yml
Original file line number Diff line number Diff line change
@@ -7,22 +7,45 @@ defaults:
on:
push:
branches: [main]
paths:
- vizro-ai/**
pull_request:
branches:
- main
paths:
- vizro-ai/**
schedule:
- cron: "30 10 * * 1" # run every Monday at 10:30 UTC
- !vizro-ai/docs/**

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

jobs:
test-integration-vizro-ai-fork:
if: ${{ github.event.pull_request.head.repo.fork }}
name: test-integration-vizro-ai on Py${{ matrix.python-version }} ${{ matrix.label }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.9"
hatch-env: all.py3.9
- python-version: "3.10"
hatch-env: all.py3.10
- python-version: "3.11"
hatch-env: all.py3.11
- python-version: "3.12"
hatch-env: all.py3.12
- python-version: "3.11"
hatch-env: lower-bounds
label: lower bounds
steps:
- uses: actions/checkout@v4

- name: Passed fork step
run: echo "Success!"

test-integration-vizro-ai:
if: ${{ ! github.event.pull_request.head.repo.fork }}
name: test-integration-vizro-ai on Py${{ matrix.python-version }} ${{ matrix.label }}
environment: vizro_ai_secrets
runs-on: ubuntu-latest

0 comments on commit f0a184b

Please sign in to comment.