[PERF]: pipeline segment committing/flushing #4590
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR checks | |
on: | |
pull_request: | |
branches: | |
- main | |
- '**' | |
jobs: | |
# GitHub only provides a way to do path filtering at the workflow level rather than the job level. | |
# This allows us to selectively run jobs based on changed paths. | |
paths-filter: | |
name: Get changed paths | |
runs-on: ubuntu-latest | |
outputs: | |
outside-docs: ${{ steps.changes.outputs.outside-docs }} | |
only-docs: ${{ steps.changes.outputs.docs }} | |
helm-changes: ${{ steps.helm-changes.outputs.helm-changes }} | |
steps: | |
- name: Get changed paths | |
id: changes | |
uses: dorny/paths-filter@v3 | |
with: | |
predicate-quantifier: 'every' | |
filters: | | |
outside-docs: | |
- '!docs/**' | |
docs: | |
- 'docs/**' | |
- name: Check for Helm changes | |
id: helm-changes | |
uses: dorny/paths-filter@v3 | |
with: | |
filters: | | |
helm-changes: | |
- 'k8s/distributed-chroma/**' | |
deploy-docs-preview: | |
name: Deploy preview of docs | |
needs: paths-filter | |
if: needs.paths-filter.outputs.only-docs == 'true' | |
runs-on: depot-ubuntu-22.04-small | |
environment: | |
name: Preview | |
url: ${{ steps.deploy.outputs.url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install vercel | |
run: npm install -g vercel | |
- name: Deploy | |
id: deploy | |
run: echo "url=$(vercel deploy --token ${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }} | |
check-helm-version-bump: | |
name: Warn if Helm chart was updated without version bump | |
needs: paths-filter | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Detect if version field in Chart.yaml was changed | |
id: detect-version-change | |
shell: bash | |
run: | | |
current=$(git show HEAD:$file | yq ".version") | |
previous=$(git show HEAD^:$file | yq ".version") | |
echo "version=$current" >> $GITHUB_OUTPUT | |
if [ "$current" != "$previous" ]; then | |
echo "Version field in $file was changed from $previous to $current" | |
echo "version_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "Version field in $file was not changed" | |
echo "version_changed=false" >> $GITHUB_OUTPUT | |
fi | |
env: | |
file: k8s/distributed-chroma/Chart.yaml | |
- name: Comment warning | |
if: ${{ steps.detect-version-change.outputs.version_changed == 'false' && needs.paths-filter.outputs.helm-changes == 'true' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: helm-chart-version-info | |
message: | | |
:warning: The Helm chart was updated without a version bump. Your changes will only be published if the version field in `k8s/distributed-chroma/Chart.yaml` is updated. | |
- name: Comment success | |
if: ${{ steps.detect-version-change.outputs.version_changed == 'true' && needs.paths-filter.outputs.helm-changes == 'true' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: helm-chart-version-info | |
message: | | |
:white_check_mark: The Helm chart's version was changed. Your changes to the chart will be published upon merge to `main`. | |
- name: Delete comment (Helm chart was not changed) | |
if: needs.paths-filter.outputs.helm-changes == 'false' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: helm-chart-version-info | |
delete: true | |
python-tests: | |
name: Python tests | |
needs: paths-filter | |
if: needs.paths-filter.outputs.outside-docs == 'true' | |
uses: ./.github/workflows/_python-tests.yml | |
with: | |
property_testing_preset: 'fast' | |
python-vulnerability-scan: | |
name: Python vulnerability scan | |
needs: paths-filter | |
if: needs.paths-filter.outputs.outside-docs == 'true' | |
uses: ./.github/workflows/_python-vulnerability-scan.yml | |
javascript-client-tests: | |
name: JavaScript client tests | |
needs: paths-filter | |
if: needs.paths-filter.outputs.outside-docs == 'true' | |
uses: ./.github/workflows/_javascript-client-tests.yml | |
rust-tests: | |
name: Rust tests | |
needs: paths-filter | |
if: needs.paths-filter.outputs.outside-docs == 'true' | |
uses: ./.github/workflows/_rust-tests.yml | |
go-tests: | |
name: Go tests | |
needs: paths-filter | |
if: needs.paths-filter.outputs.outside-docs == 'true' | |
uses: ./.github/workflows/_go-tests.yml | |
check-title: | |
name: Check PR Title | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check PR Title | |
uses: Slashgear/[email protected] | |
with: | |
regexp: '\[(ENH|BUG|DOC|TST|BLD|PERF|TYP|CLN|CHORE|RELEASE|HOTFIX)\].*' | |
helpMessage: "Please tag your PR title. See https://docs.trychroma.com/contributing#contributing-code-and-ideas. You must push new code to this PR for this check to run again." | |
- name: Comment explaining failure | |
if: failure() | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Please tag your PR title with one of: \\[ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE\\]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas' | |
}) | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/python | |
with: | |
python-version: "3.11" | |
- name: Setup Rust | |
uses: ./.github/actions/rust | |
- name: Run pre-commit | |
shell: bash | |
run: | | |
pre-commit run --all-files trailing-whitespace | |
pre-commit run --all-files mixed-line-ending | |
pre-commit run --all-files end-of-file-fixer | |
pre-commit run --all-files requirements-txt-fixer | |
pre-commit run --all-files check-xml | |
pre-commit run --all-files check-merge-conflict | |
pre-commit run --all-files check-case-conflict | |
pre-commit run --all-files check-docstring-first | |
pre-commit run --all-files black | |
pre-commit run --all-files flake8 | |
pre-commit run --all-files prettier | |
pre-commit run --all-files check-yaml | |
continue-on-error: true | |
- name: Cargo fmt check | |
shell: bash | |
run: cargo fmt -- --check | |
continue-on-error: true | |
- name: Clippy | |
run: cargo clippy --all-targets --all-features --keep-going -- -D warnings | |
# This job exists for our branch protection rule. | |
# We want to require status checks to pass before merging, but the set of | |
# checks that run for any given PR is dynamic based on the files changed. | |
# When creating a branch protection rule, you have to specify a static list | |
# of checks. | |
# So since this job always runs, we can specify it in the branch protection rule. | |
all-required-pr-checks-passed: | |
if: always() | |
needs: | |
- python-tests | |
- python-vulnerability-scan | |
- javascript-client-tests | |
- rust-tests | |
- go-tests | |
- check-title | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
allowed-skips: python-tests,python-vulnerability-scan,javascript-client-tests,rust-tests,go-tests |