Skip to content

Commit

Permalink
Merge branch 'pre-commit-ci-update-config' of https://github.com/mcki…
Browse files Browse the repository at this point in the history
…nsey/vizro into pre-commit-ci-update-config
  • Loading branch information
huong-li-nguyen committed Jun 4, 2024
2 parents 01f8ba4 + 66d8a95 commit 7cb1aa1
Show file tree
Hide file tree
Showing 277 changed files with 18,256 additions and 3,024 deletions.
112 changes: 0 additions & 112 deletions .circleci/config.yml

This file was deleted.

34 changes: 16 additions & 18 deletions .github/workflows/checks-vizro-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
# Use fetch-depth of 2 to enable the changelog fragment check, which only runs in a pull request, not on push.
# See https://stackoverflow.com/questions/74265821/get-modified-files-in-github-actions
fetch-depth: 2

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
Expand All @@ -42,23 +44,19 @@ jobs:
- name: Check requirements for Snyk are up to date
run: hatch run all.py${{ env.PYTHON_VERSION }}:update-snyk-requirements --check

- name: Find added changelog fragments
id: added-files
- name: Find changed files to see if changelog fragment needed
id: changed-files
if: ${{ github.event_name == 'pull_request' }}
# --no-renames is required so that an empty changelog file added in a release PR always counts as added rather
# than a renamed version of an already-existing empty changelog file.
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "added_files=$(git diff --name-only --diff-filter=A -r HEAD^1 HEAD -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT
else
echo "added_files=$(git diff --name-only --diff-filter=A ${{ github.event.before }} ${{ github.event.after }} -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT
fi
echo "changelog_fragment_added=$(git diff --name-only --no-renames --diff-filter=A HEAD^1 HEAD -- 'changelog.d/*.md' | xargs)" >> $GITHUB_OUTPUT
echo "files_outside_docs_changed=$(git diff --name-only HEAD^1 HEAD -- ':!docs' | xargs)" >> $GITHUB_OUTPUT
- name: Fail if no fragment added in PR
- name: Fail if changelog fragment needed and wasn't added
if: ${{ steps.changed-files.outcome != 'skipped' && steps.changed-files.outputs.files_outside_docs_changed && !steps.changed-files.outputs.changelog_fragment_added}}
run: |
if [ -z "${{ steps.added-files.outputs.added_files }}" ];
then
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment.";
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1
else
echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!";
fi
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment."
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1
34 changes: 16 additions & 18 deletions .github/workflows/checks-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
# Use fetch-depth of 2 to enable the changelog fragment check, which only runs in a pull request, not on push.
# See https://stackoverflow.com/questions/74265821/get-modified-files-in-github-actions
fetch-depth: 2

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
Expand All @@ -45,23 +47,19 @@ jobs:
- name: Check requirements for Snyk are up to date
run: hatch run all.py${{ env.PYTHON_VERSION }}:update-snyk-requirements --check

- name: Find added changelog fragments
id: added-files
- name: Find changed files to see if changelog fragment needed
id: changed-files
if: ${{ github.event_name == 'pull_request' }}
# --no-renames is required so that an empty changelog file added in a release PR always counts as added rather
# than a renamed version of an already-existing empty changelog file.
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "added_files=$(git diff --name-only --diff-filter=A -r HEAD^1 HEAD -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT
else
echo "added_files=$(git diff --name-only --diff-filter=A ${{ github.event.before }} ${{ github.event.after }} -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT
fi
echo "changelog_fragment_added=$(git diff --name-only --no-renames --diff-filter=A HEAD^1 HEAD -- 'changelog.d/*.md' | xargs)" >> $GITHUB_OUTPUT
echo "files_outside_docs_changed=$(git diff --name-only HEAD^1 HEAD -- ':!docs' | xargs)" >> $GITHUB_OUTPUT
- name: Fail if no fragment added in PR
- name: Fail if changelog fragment needed and wasn't added
if: ${{ steps.changed-files.outcome != 'skipped' && steps.changed-files.outputs.files_outside_docs_changed && !steps.changed-files.outputs.changelog_fragment_added}}
run: |
if [ -z "${{ steps.added-files.outputs.added_files }}" ];
then
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment.";
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1
else
echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!";
fi
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment."
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1
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
2 changes: 0 additions & 2 deletions .github/workflows/lint-vizro-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-if-needed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
package_version: ${{ steps.version_check.outputs.package_version }}

build-publish:
environment: vizro_secrets
needs: [check-version]
if: |
needs.check-version.outputs.new_release == 'True'
Expand Down Expand Up @@ -84,6 +85,7 @@ jobs:
password: ${{ env.PYPI_TOKEN }}

version-bump:
environment: vizro_secrets
needs: [check-version, build-publish]
if: |
needs.check-version.outputs.new_release == 'True'
Expand All @@ -101,6 +103,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install hatch
# if you want to change this step please contact tech lead
- name: Push bumped version to main
run: |
cd "${{ needs.check-version.outputs.package_name }}"
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/test-integration-vizro-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,47 @@ defaults:
on:
push:
branches: [main]
schedule:
- cron: "30 10 * * 1" # run every Monday at 10:30 UTC
pull_request:
branches:
- main
paths:
- "vizro-ai/**"
- "!vizro-ai/docs/**"

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1

jobs:
test-integration-vizro-ai:
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
strategy:
fail-fast: false
Expand All @@ -37,8 +67,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integration-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install Chrome and chromedriver
run: |
export chrome_version=119.0.6045.105
sudo apt-get update
sudo apt-get update || true
sudo apt-get install libu2f-udev -y
wget "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_$chrome_version-1_amd64.deb"
sudo apt-get install -y --allow-downgrades ./google-chrome-stable_$chrome_version-1_amd64.deb
Expand Down
Loading

0 comments on commit 7cb1aa1

Please sign in to comment.