Tests #386
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: Tests | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
pull_request: | |
schedule: | |
- cron: '0 8 * * *' | |
jobs: | |
test: | |
name: Test | |
if: github.event_name != 'schedule' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
test-args: | |
- "--features aws-auth" | |
- "--no-default-features --features rustls-tls --package opensearch --test cert" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Rust Client | |
uses: actions/checkout@v3 | |
with: | |
path: client | |
- name: Setup Rust tools | |
uses: ./client/.github/actions/setup-rust-tools | |
- name: Run OpenSearch | |
id: opensearch | |
uses: ./client/.github/actions/run-released-opensearch | |
with: | |
version: 2.8.0 | |
secured: true | |
- name: Run Tests (${{ matrix.test-args }}) | |
working-directory: client | |
run: cargo make test ${{ matrix.test-args }} | |
env: | |
OPENSEARCH_URL: ${{ steps.opensearch.outputs.opensearch_url }} | |
- name: Upload Coverage Data | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./test_results/opensearch.lcov | |
flags: unit | |
- name: Save OpenSearch logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: opensearch-${{ matrix.os }}-${{ matrix.test-args }} | |
path: | | |
opensearch-*/logs/* | |
test-yaml: | |
name: YAML Tests (Released OpenSearch) | |
if: github.event_name != 'schedule' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ['1.1.0', '1.2.4', '1.3.4', '2.2.0', '2.4.0', '2.6.0', '2.8.0'] | |
secured: [true, false] | |
steps: | |
- name: Checkout Rust Client | |
uses: actions/checkout@v3 | |
with: | |
path: client | |
- name: Setup Rust tools | |
uses: ./client/.github/actions/setup-rust-tools | |
- name: Run OpenSearch | |
id: opensearch | |
uses: ./client/.github/actions/run-released-opensearch | |
with: | |
version: ${{ matrix.version }} | |
secured: ${{ matrix.secured }} | |
- name: Run integration tests | |
working-directory: client | |
run: cargo make test-yaml | |
env: | |
OPENSEARCH_URL: ${{ steps.opensearch.outputs.opensearch_url }} | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./client/test_results/opensearch.lcov | |
flags: integration | |
- name: Save OpenSearch logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: opensearch-logs-${{ matrix.version }}-${{ matrix.secured }} | |
path: | | |
opensearch-*/logs/* | |
test-yaml-unreleased: | |
name: YAML Tests (Unreleased OpenSearch) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
opensearch_ref: ['1.x', '2.0', '2.x', 'main'] | |
steps: | |
- name: GitHub App token | |
id: github_app_token | |
uses: tibdex/[email protected] | |
if: github.event_name == 'schedule' | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
installation_id: 22958780 | |
- name: Checkout Rust Client | |
uses: actions/checkout@v3 | |
with: | |
path: client | |
- name: Setup Rust tools | |
uses: ./client/.github/actions/setup-rust-tools | |
- name: Checkout OpenSearch | |
uses: actions/checkout@v3 | |
with: | |
repository: opensearch-project/opensearch | |
ref: ${{ matrix.opensearch_ref }} | |
path: opensearch | |
- name: Get OpenSearch Commit SHA | |
id: opensearch-git | |
working-directory: opensearch | |
shell: bash -eo pipefail {0} | |
run: echo sha=`git log -1 --format='%H'` >> $GITHUB_OUTPUT | |
- name: Restore cached OpenSearch | |
id: cache-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: opensearch-* | |
key: opensearch-${{ steps.opensearch-git.outputs.sha }} | |
- name: Build OpenSearch | |
if: steps.cache-restore.outputs.cache-hit != 'true' | |
shell: bash -eo pipefail {0} | |
run: | | |
pushd ./opensearch | |
./gradlew :distribution:archives:linux-tar:assemble | |
popd | |
tar -xzf ./opensearch/distribution/archives/linux-tar/build/distributions/opensearch-*.tar.gz | |
- name: Save cached OpenSearch | |
if: steps.cache-restore.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: opensearch-* | |
key: opensearch-${{ steps.opensearch-git.outputs.sha }} | |
- name: Start OpenSearch | |
id: opensearch | |
uses: ./client/.github/actions/start-opensearch | |
- name: Run integration tests | |
working-directory: client | |
run: cargo make test-yaml | |
env: | |
OPENSEARCH_URL: ${{ steps.opensearch.outputs.url }} | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./client/test_results/opensearch.lcov | |
flags: integration | |
- name: Save OpenSearch logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: opensearch-logs-${{ matrix.opensearch_ref }} | |
path: | | |
opensearch-*/logs/* | |
- name: Create issue about failure | |
if: failure() && github.event_name == 'schedule' | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ steps.github_app_token.outputs.token }} | |
with: | |
filename: ./client/.github/test-failure-issue-template.md | |
update_existing: true |