Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sample code to user_guide.md #107

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
164 changes: 130 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,101 @@
name: PHP test
name: PHP

on: [push, pull_request]
on:
push:
paths:
- "**.php"
pull_request:

jobs:
test:
name: Test
code-style:
name: Code Style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist

- name: PHP CS Fixer
run: |
composer run-script php-cs

static-analyse:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist

- name: PHP Static Analysis Tool
run: |
composer run-script phpstan

coverage:
name: Coverage
runs-on: ubuntu-latest
services:
search-server:
image: opensearchproject/opensearch:2.2.1
ports:
- 9200:9200
env:
discovery.type: single-node
plugins.security.disabled: 'true'

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

- name: Use PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: yaml, zip, curl, pcov
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist

- name: Wait for Search server
run: php ./.github/wait_for_es.php

- name: PHPUnit
run: |
composer run-script phpunit
env:
OPENSEARCH_URL: 'http://localhost:9200'

- uses: codecov/codecov-action@v3
with:
file: ./clover.xml

unit-test:
name: "Unit Test"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -15,24 +106,45 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist

- name: Unit tests
run: |
composer run unit

integration-test:
name: Tntegration Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
search-server-image:
- docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0
- opensearchproject/opensearch:1.0.0
- opensearchproject/opensearch:1.0.1
- opensearchproject/opensearch:1.1.0
- opensearchproject/opensearch:1.2.0
- opensearchproject/opensearch:1.2.1
- opensearchproject/opensearch:1.2.2
- opensearchproject/opensearch:1.2.3
- opensearchproject/opensearch:1.2.4
- opensearchproject/opensearch:1.3.0
- opensearchproject/opensearch:1.3.1
- opensearchproject/opensearch:1.3.2
- opensearchproject/opensearch:1.3.3
- opensearchproject/opensearch:2.0.0
- opensearchproject/opensearch:2.0.1
- opensearchproject/opensearch:1.3.6
- opensearchproject/opensearch:2.1.0
- opensearchproject/opensearch:2.2.1
services:
search-server:
image: ${{ matrix.search-server-image }}
Expand All @@ -46,10 +158,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Use PHP ${{ matrix.php-version }}
- name: Use PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: 8.1
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -58,25 +170,9 @@ jobs:
run: |
composer install --prefer-dist

- name: PHP CS Fixer
if: matrix.php-version == '8.1'
run: |
composer run-script php-cs

- name: PHP Static Analysis Tool
if: matrix.php-version == '8.1'
run: |
composer run-script phpstan

- name: Wait for Search server
run: php ./.github/wait_for_es.php

- name: Unit tests
run: |
composer run unit
env:
TEST_SUITE: free

- name: Integration tests
run: |
composer run integration
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/test_unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ jobs:
run: |
composer install --prefer-dist

- name: PHP CS Fixer
run: |
composer run-script php-cs

- name: PHP Static Analysis Tool
run: |
composer run-script phpstan

- name: Wait for Search server
run: php ./.github/wait_for_es.php

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ util/doctum.phar
.phpunit.result.cache

# Code coverage
build
/clover.xml

# Do not ignore Doctum docs built files
!/docs/build

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Changed

- Added Windows and macOS jobs to CI
- Added Coverage reporting to Codecov

### Deprecated

### Removed
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Welcome!](#welcome)
- [Project Resources](#project-resources)
- [Code of Conduct](#code-of-conduct)
- [Sample code](#sample-code)
- [Compatibility with OpenSearch](#compatibility-with-opensearch)
- [License](#license)
- [Copyright](#copyright)
Expand All @@ -14,7 +15,7 @@
## Project Resources

* [Project Website](https://opensearch.org/)
* [User Guide](https://github.com/opensearch-project/opensearch-php/blob/main/USER_GUIDE.md)
* [User Guide And Sample Code](https://github.com/opensearch-project/opensearch-php/blob/main/USER_GUIDE.md)
* [Developer Guide](https://github.com/opensearch-project/opensearch-php/blob/main/DEVELOPER_GUIDE.md)
* [Downloads](https://opensearch.org/downloads.html).
* [Documentation](https://opensearch.org/docs/latest/)
Expand All @@ -30,6 +31,10 @@

This project has adopted the [Amazon Open Source Code of Conduct](https://github.com/opensearch-project/opensearch-php/blob/main/CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Sample code

See [Sample Code](https://github.com/opensearch-project/opensearch-php/blob/main/USER_GUIDE.md).

## Compatibility with OpenSearch

See [Compatibility](COMPATIBILITY.md).
Expand Down
Loading