compose title for processing status results #6383
Workflow file for this run
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: nucliadb Search (py) | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/nucliadb_search.yml' | |
- 'charts/nucliadb_search/**' | |
- 'nucliadb_utils/**' | |
- 'nucliadb/nucliadb/ingest/**' | |
- 'nucliadb/nucliadb/search/**' | |
- 'nucliadb/nucliadb/common/**' | |
- 'nucliadb_models/**' | |
- 'nucliadb_telemetry/**' | |
- 'nucliadb_protos/python/**' | |
- 'nucliadb_node/**' | |
- 'nucliadb_vectors/**' | |
- 'nucliadb_texts/**' | |
- 'nucliadb_texts2/**' | |
- 'nucliadb_paragraphs/**' | |
- 'nucliadb_core/**' | |
- 'nucliadb_relations/**' | |
- 'nucliadb_relations2/**' | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/nucliadb_search.yml' | |
- 'charts/nucliadb_search/**' | |
- 'nucliadb_utils/**' | |
- 'nucliadb/nucliadb/ingest/**' | |
- 'nucliadb/nucliadb/search/**' | |
- 'nucliadb/nucliadb/common/**' | |
- 'nucliadb_models/**' | |
- 'nucliadb_telemetry/**' | |
- 'nucliadb_protos/python/**' | |
- 'nucliadb_node/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
CONTAINER_REGISTRY: eu.gcr.io/${{ secrets.PROJECT_ID }} | |
IMAGE_NAME: search | |
jobs: | |
# Job to run pre-checks | |
pre-checks: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install package | |
run: make -C nucliadb/ install-dev | |
- name: Run pre-checks | |
run: make -C nucliadb/ lint-search | |
# Job to run tests | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
include: | |
- maindb_driver: "tikv" | |
storage_backend: "gcs" | |
python-version: "3.11" | |
- maindb_driver: "tikv" | |
storage_backend: "s3" | |
python-version: "3.11" | |
- maindb_driver: "pg" | |
storage_backend: "gcs" | |
python-version: "3.11" | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
# Setup gcloud CLI | |
- uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
# setup docker, as we need to pull the node image to run the tests | |
- name: Configure Docker | |
run: docker login -u oauth2accesstoken -p "$(gcloud auth application-default print-access-token)" https://eu.gcr.io | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install the package | |
run: make -C nucliadb/ install-dev | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
node_modified: | |
- 'nucliadb_core/**' | |
- 'nucliadb_node/src/**' | |
- 'nucliadb_paragraphs/**' | |
- 'nucliadb_procs/**' | |
- 'nucliadb_relations/**' | |
- 'nucliadb_relations2/**' | |
- 'nucliadb_telemetry/**' | |
- 'nucliadb_texts/**' | |
- 'nucliadb_vectors/**' | |
sidecar_modified: | |
- 'nucliadb_node/nucliadb_node/**' | |
- name: Calc git info | |
id: git | |
run: |- | |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | |
echo "branch=$BRANCH" >> $GITHUB_OUTPUT | |
- name: Install jq | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y jq | |
- name: Build local Node for testing | |
if: steps.filter.outputs.node_modified == 'true' | |
env: | |
SECRET_KEY: ${{ secrets.RUST_BUILD_SERVER_SECRET }} | |
COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }} | |
BRANCH: ${{ steps.git.outputs.branch }} | |
run: | | |
make build-node-debug | |
- name: Build local Sidecar for testing | |
if: steps.filter.outputs.sidecar_modified == 'true' | |
run: | | |
make build-sidecar | |
- name: Run tests | |
env: | |
TESTING_MAINDB_DRIVER: ${{ matrix.maindb_driver }} | |
TESTING_STORAGE_BACKEND: ${{ matrix.storage_backend }} | |
run: | | |
pytest -x -rfE --cov=nucliadb.search -s --tb=native -v --cov-report xml --cov-append --benchmark-json benchmarks.json nucliadb/nucliadb/search | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: search | |
- name: Download previous benchmark data | |
uses: actions/cache@v1 | |
with: | |
path: ./cache | |
key: ${{ runner.os }}-search-benchmark | |
- name: Comment and Store benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: github.event_name == 'push' | |
with: | |
tool: 'pytest' | |
output-file-path: benchmarks.json | |
external-data-json-path: ./cache/benchmark-data.json | |
save-data-file: true | |
comment-always: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
comment-on-alert: true | |
fail-on-alert: true | |
alert-comment-cc-users: '@nuclia/nuclia-db' | |
- name: Comment benchmark result based on main | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: github.event_name != 'push' | |
with: | |
tool: 'pytest' | |
output-file-path: benchmarks.json | |
external-data-json-path: ./cache/benchmark-data.json | |
save-data-file: false | |
comment-always: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
comment-on-alert: true | |
fail-on-alert: true | |
alert-comment-cc-users: '@nuclia/nuclia-db' | |
- name: Store on GH Pages | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: github.event_name == 'push' | |
with: | |
tool: 'pytest' | |
output-file-path: benchmarks.json | |
auto-push: true | |
gh-repository: github.com/nuclia/nucliadb_performance | |
gh-pages-branch: main | |
github-token: ${{ secrets.PERFORMANCE_TOKEN }} | |
# PR workflows END here | |
# PUSH workflows contine with deploy activities | |
build: | |
name: Build image and push | |
needs: tests | |
uses: ./.github/workflows/_build-img-nucliadb.yml | |
with: | |
platforms: linux/amd64,linux/arm64 | |
image-name: search | |
cache-gha-mode: min | |
secrets: | |
inherit | |
if: github.event_name == 'push' | |
deploy: | |
name: Deploy Helm chart and trigger internal CI | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Calculate short sha | |
id: env-vars | |
run: |- | |
HASH=`git rev-parse --short HEAD` | |
echo "short_sha=$HASH" >> $GITHUB_OUTPUT | |
- name: Set helm package image | |
id: version_step | |
run: |- | |
sed -i.bak "s#IMAGE_TO_REPLACE#$IMAGE_NAME:${{ steps.env-vars.outputs.short_sha }}#" ./charts/nucliadb_search/values.yaml | |
sed -i.bak "s#CONTAINER_REGISTRY_TO_REPLACE#$CONTAINER_REGISTRY#" ./charts/nucliadb_search/values.yaml | |
VERSION=`cat VERSION` | |
VERSION_SHA=$VERSION+${{ steps.env-vars.outputs.short_sha }} | |
sed -i.bak "s#99999.99999.99999#$VERSION_SHA#" ./charts/nucliadb_search/Chart.yaml | |
echo "version_number=$VERSION_SHA" >> $GITHUB_OUTPUT | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.4.0 | |
- name: Push helm package | |
run: |- | |
helm lint charts/nucliadb_search | |
helm package charts/nucliadb_search | |
curl --data-binary "@nucliadb_search-${{ steps.version_step.outputs.version_number }}.tgz" ${{ secrets.HELM_CHART_URL }}/api/charts | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.GH_CICD_PUBLIC }} | |
repository: nuclia/nucliadb_deploy | |
event-type: promote | |
client-payload: '{"component": "nucliadb_search", "chart-version": "${{ steps.version_step.outputs.version_number }}" }' |