Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 39 additions & 37 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ jobs:
name: Run Linter and Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Lint pinned actions
run: bash tools/linter_actions_pinned.sh
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
Expand Down Expand Up @@ -66,13 +68,13 @@ jobs:
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
folder: ["weaviate", "integration", "integration_embedded"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.version }}
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements-devel.txt
- uses: jakebailey/pyright-action@v2
- uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2
with:
version: 1.1.399
working-directory: ${{ matrix.folder }}
Expand All @@ -86,8 +88,8 @@ jobs:
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
folder: ["test", "mock_tests"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.version }}
cache: 'pip' # caching pip dependencies
Expand All @@ -96,7 +98,7 @@ jobs:
run: pytest --cov -v --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-${{ matrix.folder }}.xml ${{ matrix.folder }}
- name: Archive code coverage results
if: matrix.version == '3.10' && (github.ref_name != 'main')
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage-report-${{ matrix.folder }}
path: coverage-${{ matrix.folder }}.xml
Expand All @@ -110,8 +112,8 @@ jobs:
grpc: ["1.59.5", "1.63.0", "1.65.0", "1.66.0", "1.68.0", "1.72.1", "1.73.0", "1.74.0"]
protobuf: ["4.25.8", "5.26.0", "5.27.4", "5.28.3", "5.29.0", "6.30.0", "6.31.1", "6.32.0"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
Expand All @@ -129,11 +131,11 @@ jobs:
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
optional_dependencies: [false]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.version }}
cache: 'pip' # caching pip dependencies
Expand All @@ -145,7 +147,7 @@ jobs:
run: pytest -v --cov --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-integration-embedded.xml integration_embedded
- name: Archive code coverage results
if: matrix.version == '3.10' && (github.ref_name != 'main') && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage-report-integration-embedded
path: coverage-integration-embedded.xml
Expand All @@ -165,16 +167,16 @@ jobs:
]
optional_dependencies: [false]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.versions.py }}
cache: 'pip' # caching pip dependencies
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
with:
username: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -198,7 +200,7 @@ jobs:
run: pytest -n auto --dist loadgroup -v --cov --cov-report=term-missing --cov=weaviate --cov-report xml:coverage-integration.xml integration
- name: Archive code coverage results
if: matrix.versions.py == '3.10' && (github.ref_name != 'main')
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage-report-integration
path: coverage-integration.xml
Expand All @@ -220,13 +222,13 @@ jobs:
]
optional_dependencies: [false]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
with:
username: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -245,25 +247,25 @@ jobs:
runs-on: ubuntu-latest
if: github.ref_name != 'main' && !github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download coverage artifacts mock
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: coverage-report-mock_tests
- name: Download coverage artifacts unit
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: coverage-report-test
- name: Download coverage integration
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: coverage-report-integration
- name: Download coverage integration embedded
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: coverage-report-integration-embedded
- name: Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
with:
fail_ci_if_error: true
files: ./coverage-integration.xml, ./coverage-integration-embedded.xml, ./coverage-test.xml, ./coverage-mock_tests.xml
Expand All @@ -275,11 +277,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
Expand All @@ -288,7 +290,7 @@ jobs:
- name: Build a binary wheel
run: python -m build
- name: Create Wheel Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
path: "dist/*.whl"
name: weaviate-python-client-wheel
Expand All @@ -315,17 +317,17 @@ jobs:
]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Download build artifact to append to release
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: weaviate-python-client-wheel
- run: |
Expand All @@ -343,11 +345,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
cache: 'pip' # caching pip dependencies
Expand All @@ -357,7 +359,7 @@ jobs:
run: python -m build
- name: Publish distribution 📦 to PyPI on new tags
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
with:
verbose: true
password: ${{ secrets.PYPI_API_TOKEN }}
Expand All @@ -369,12 +371,12 @@ jobs:
needs: [build-and-publish]
steps:
- name: Download build artifact to append to release
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: weaviate-python-client-wheel
path: dist
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
generate_release_notes: true
draft: true
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pr-security-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Security Lint

on:
pull_request_target:
types: [opened, synchronize, reopened]

# No permissions at workflow level — grant only what's needed at job level
permissions: {}

jobs:
hidden-unicode-check:
name: Check for hidden Unicode characters
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout base branch
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
ref: ${{ github.event.pull_request.base.sha }}

- name: Check PR diff for hidden Unicode
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr diff ${{ github.event.pull_request.number }} | bash tools/linter_hidden_unicode.sh --stdin
49 changes: 49 additions & 0 deletions tools/linter_actions_pinned.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Lint GitHub Actions workflow files to ensure all external actions are pinned to SHA hashes.
# Usage: bash tools/linter_actions_pinned.sh

set -euo pipefail

ERRORS=0

for workflow in .github/workflows/*.yaml .github/workflows/*.yml; do
[ -f "$workflow" ] || continue

while IFS= read -r line; do
lineno=$(echo "$line" | cut -d: -f1)
content=$(echo "$line" | cut -d: -f2-)

# Extract the action reference (everything after "uses:")
action_ref=$(echo "$content" | sed -n 's/.*uses:[[:space:]]*//p' | xargs)

# Skip local actions (starting with ./)
if [[ "$action_ref" == ./* ]]; then
continue
fi

# Extract the version part (after @, before space or # comment)
version=$(echo "$action_ref" | sed -n 's/.*@\([^ #]*\).*/\1/p')

if [ -z "$version" ]; then
echo "::error file=${workflow},line=${lineno}::Action missing version pin: ${action_ref}"
ERRORS=$((ERRORS + 1))
continue
fi

# Check that the version is a 40-character hex SHA
if ! echo "$version" | grep -qE '^[0-9a-f]{40}$'; then
echo "::error file=${workflow},line=${lineno}::Action not pinned to SHA: ${action_ref} (version: ${version})"
ERRORS=$((ERRORS + 1))
fi
done < <(grep -n 'uses:' "$workflow")
done

if [ "$ERRORS" -gt 0 ]; then
echo ""
echo "ERROR: Found ${ERRORS} action(s) not pinned to a SHA hash."
echo "Replace tag references (e.g., @v5) with the full commit SHA (e.g., @93cb6ef...)"
echo "Preserve the tag as a comment: uses: actions/checkout@<SHA> # v5"
exit 1
fi

echo "All GitHub Actions are pinned to SHA hashes."
Loading
Loading