Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Update CI workflows to use more Python and OpenSearch versions #92

Merged
merged 7 commits into from
Feb 15, 2023
Merged
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
31 changes: 20 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand All @@ -28,9 +28,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand All @@ -43,9 +43,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install build tools
Expand All @@ -56,23 +56,32 @@ jobs:
python3.7 -m build

test-linux:
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', '3.11']
runner: ['ubuntu-latest']
include:
- runner: 'ubuntu-20.04'
python-version: '3.5'
- runner: 'ubuntu-20.04'
python-version: '3.6'

steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Setup Python - ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
env:
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1
- name: Set up Python 3.8 for Nox
if: matrix.python-version != '3.8'
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install nox
Expand Down
76 changes: 55 additions & 21 deletions .github/workflows/integration-unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,83 @@ name: Integration with Unreleased OpenSearch

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
test:
integ-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
entry:
- { opensearch_ref: '1.x' }
- { opensearch_ref: '2.x' }
- { opensearch_ref: '2.0' }
- { opensearch_ref: 'main' }
opensearch_ref: [ '1.x', '2.x', '2.0', 'main' ]
python-version: [ '3.8' ]

steps:
- name: Checkout OpenSearch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: opensearch-project/opensearch
ref: ${{ matrix.entry.opensearch_ref }}
ref: ${{ matrix.opensearch_ref }}
path: opensearch

- name: Get OpenSearch branch top
id: get-key
working-directory: opensearch
run: echo key=`git log -1 --format='%H'` >> $GITHUB_OUTPUT

- name: Restore cached build
id: cache-restore
uses: actions/cache/restore@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- name: Assemble OpenSearch
run: |
cd opensearch
./gradlew assemble
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: opensearch
run: ./gradlew :distribution:archives:linux-tar:assemble

# This step runs the docker image generated during gradle assemble in OpenSearch. It is tagged as opensearch:test.
# Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190
- name: Run Docker Image
- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- name: Run OpenSearch
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test
sleep 90
tar xf opensearch-min-*
./opensearch-*/bin/opensearch &
for attempt in {1..20}; do sleep 5; if curl -s localhost:9200; then echo '=====> ready'; break; fi; echo '=====> waiting...'; done

- name: Checkout High Level Python Client
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: dsl-py

- name: Install Nox
run: pip install nox
- name: Setup Python - ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
env:
PIP_NO_PYTHON_VERSION_WARNING: 1

- name: Install nox
run: |
python -m pip install nox

- name: Run integration tests
working-directory: dsl-py
run: |
nox --no-error-on-missing-interpreter -rs lint test

- name: Save server logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: opensearch-logs-${{ matrix.opensearch_ref }}-python-${{ matrix.python-version }}
path: |
opensearch/distribution/archives/linux-tar/build/distributions/**/logs/*
34 changes: 15 additions & 19 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,13 @@ jobs:
strategy:
fail-fast: false
matrix:
entry:
- { version: 1.0.0 }
- { version: 1.0.1 }
- { version: 1.1.0 }
- { version: 1.2.0 }
- { version: 1.2.1 }
- { version: 1.2.2 }
- { version: 1.2.3 }
- { version: 1.2.4 }
- { version: 1.3.0 }
- { version: 1.3.1 }
- { version: 1.3.2 }
- { version: 1.3.3 }
- { version: 2.0.0 }
- { version: 2.0.1 }
secured: ["true", "false"]
version: [ '1.0.1', '1.1.0', '1.2.4', '1.3.7', '2.0.1', '2.1.0', '2.2.1', '2.3.0', '2.4.0', '2.5.0' ]
secured: [ "true", "false" ]
python-version: [ '3.8' ]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Clean docker containers
run: |
Expand All @@ -43,8 +30,17 @@ jobs:
docker-compose --project-directory .ci/opensearch build
docker-compose --project-directory .ci/opensearch up -d

- name: Install Nox
run: pip install nox
- name: Setup Python - ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_NO_PYTHON_VERSION_WARNING: 1

- name: Install nox
run: |
python -m pip install --upgrade pip nox

- name: Integ OpenSearch secured=${{ matrix.secured }}
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed

### Fixed
- Update CI workflow python versions ([#92](https://github.com/opensearch-project/opensearch-dsl-py/pull/92))

### Security

Expand Down
1 change: 0 additions & 1 deletion opensearch_dsl/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def to_dict(self):
return d

def save(self, using=None):

opensearch = get_connection(using or self._index._using)
return opensearch.indices.put_template(
name=self._template_name, body=self.to_dict()
Expand Down
1 change: 0 additions & 1 deletion opensearch_dsl/update_by_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@


class UpdateByQuery(Request):

query = ProxyDescriptor("query")

def __init__(self, **kwargs):
Expand Down