Skip to content

Use Testcontainers for integration tests #1731

Use Testcontainers for integration tests

Use Testcontainers for integration tests #1731

Workflow file for this run

name: Code Generation
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' # 00:00 UTC Weekly on Mondays
jobs:
up_to_date:
name: Ensure Generated Code Is Up To Date
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout Java Client
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up JDK
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
java-version: 21
distribution: 'temurin'
cache: 'gradle'
- name: Run Code Generator
run: ./gradlew :java-codegen:run
- name: Check For Uncommitted Changes
shell: bash -eo pipefail {0}
run: |
output=$(git status --porcelain)
if [ -z "$output" ]; then
echo "Clean working directory"
exit 0
else
echo "Dirty working directory"
echo "$output"
exit 1
fi
update_spec:
name: Update Specification and Re-generate Code
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && github.repository == 'opensearch-project/opensearch-java')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Java Client
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up JDK
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
java-version: 21
distribution: 'temurin'
cache: 'gradle'
- name: Download Latest Spec && Run Code Generator
run: ./gradlew :java-codegen:downloadLatestSpec :java-codegen:run
- name: Get Current Date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Generate GitHub App Token
if: github.repository == 'opensearch-project/opensearch-java'
id: github_app_token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8
with:
token: ${{ steps.github_app_token.outputs.token || secrets.GITHUB_TOKEN }}
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: Re-generate client code using latest OpenSearch API specification (${{ steps.date.outputs.date }})
title: Re-generated client code using latest OpenSearch API specification
body: |
Re-generated client code using latest OpenSearch API specification.
Date: ${{ steps.date.outputs.date }}
branch: code-gen/${{ github.ref_name }}/update
signoff: true
labels: |
autocut