Skip to content

Bump actions/setup-java from 3 to 4 #1233

Bump actions/setup-java from 3 to 4

Bump actions/setup-java from 3 to 4 #1233

Workflow file for this run

name: Tests
on:
push:
branches-ignore:
- "dependabot/**"
pull_request:
schedule:
- cron: "0 8 * * *"
permissions:
id-token: write
contents: read
jobs:
test:
name: Test
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
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@v4
with:
path: client
- name: Setup Rust tools
uses: ./client/.github/actions/setup-rust-tools
- name: Install Java
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Run OpenSearch
id: opensearch
uses: ./client/.github/actions/run-released-opensearch
with:
version: 2.16.0
secured: true
- name: Run Tests
working-directory: client
run: cargo make test ${{ matrix.test-args }}
env:
OPENSEARCH_URL: ${{ steps.opensearch.outputs.opensearch_url }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- name: Upload Coverage Data
uses: codecov/codecov-action@v5
with:
files: ./client/test_results/opensearch.lcov
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
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:
- 2.16.0
- 2.14.0
- 2.12.0
- 2.10.0
- 2.8.0
- 2.6.0
- 2.4.1
- 2.2.1
- 2.0.1
- 1.3.14
- 1.2.4
- 1.1.0
secured: [true, false]
steps:
- name: Checkout Rust Client
uses: actions/checkout@v4
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 }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- uses: codecov/codecov-action@v5
with:
files: ./client/test_results/opensearch.lcov
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
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:
include:
- { opensearch_ref: "1.x", java_version: "11" }
- { opensearch_ref: "2.x", java_version: "17" }
- { opensearch_ref: "main", java_version: "21" }
steps:
- name: GitHub App token
id: github_app_token
uses: actions/create-github-app-token@v1
if: github.event_name == 'schedule' && github.repository == 'opensearch-project/opensearch-rs'
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout Rust Client
uses: actions/checkout@v4
with:
path: client
- name: Setup Rust tools
uses: ./client/.github/actions/setup-rust-tools
- name: Checkout OpenSearch
uses: actions/checkout@v4
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@v4
with:
path: opensearch-*
key: opensearch-${{ steps.opensearch-git.outputs.sha }}
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.java_version }}
- 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@v4
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 }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- uses: codecov/codecov-action@v5
if: github.event_name != 'schedule'
with:
files: ./client/test_results/opensearch.lcov
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: opensearch-logs-${{ matrix.opensearch_ref }}
path: |
opensearch-*/logs/*
- name: Create issue about failure
if: failure() && github.event_name == 'schedule' && github.repository == 'opensearch-project/opensearch-rs'
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